Commit 8e3fa336 authored by Wouter van Oortmerssen's avatar Wouter van Oortmerssen Committed by GitHub

Merge pull request #3998 from aardappel/master

Switched C# accessors from classes to structs
parents d05d1145 52ca7550
...@@ -295,12 +295,12 @@ namespace FlatBuffers ...@@ -295,12 +295,12 @@ namespace FlatBuffers
PutInt(_vectorNumElems); PutInt(_vectorNumElems);
return new VectorOffset(Offset); return new VectorOffset(Offset);
} }
/// <summary> /// <summary>
/// Creates a vector of tables. /// Creates a vector of tables.
/// </summary> /// </summary>
/// <param name="offsets">Offsets of the tables.</param> /// <param name="offsets">Offsets of the tables.</param>
public VectorOffset CreateVectorOfTables<T>(Offset<T>[] offsets) where T : class public VectorOffset CreateVectorOfTables<T>(Offset<T>[] offsets) where T : struct
{ {
NotNested(); NotNested();
StartVector(sizeof(int), offsets.Length, sizeof(int)); StartVector(sizeof(int), offsets.Length, sizeof(int));
......
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace FlatBuffers
{
/// <summary>
/// This is the base for both structs and tables.
/// </summary>
public interface IFlatbufferObject
{
void __init(int _i, ByteBuffer _bb);
}
}
...@@ -19,7 +19,7 @@ namespace FlatBuffers ...@@ -19,7 +19,7 @@ namespace FlatBuffers
/// <summary> /// <summary>
/// Offset class for typesafe assignments. /// Offset class for typesafe assignments.
/// </summary> /// </summary>
public struct Offset<T> where T : class public struct Offset<T> where T : struct
{ {
public int Value; public int Value;
public Offset(int value) public Offset(int value)
......
...@@ -19,9 +19,9 @@ namespace FlatBuffers ...@@ -19,9 +19,9 @@ namespace FlatBuffers
/// <summary> /// <summary>
/// All structs in the generated code derive from this class, and add their own accessors. /// All structs in the generated code derive from this class, and add their own accessors.
/// </summary> /// </summary>
public abstract class Struct public struct Struct
{ {
protected int bb_pos; public int bb_pos;
protected ByteBuffer bb; public ByteBuffer bb;
} }
} }
\ No newline at end of file
...@@ -20,42 +20,42 @@ using System.Text; ...@@ -20,42 +20,42 @@ using System.Text;
namespace FlatBuffers namespace FlatBuffers
{ {
/// <summary> /// <summary>
/// All tables in the generated code derive from this class, and add their own accessors. /// All tables in the generated code derive from this struct, and add their own accessors.
/// </summary> /// </summary>
public abstract class Table public struct Table
{ {
protected int bb_pos; public int bb_pos;
protected ByteBuffer bb; public ByteBuffer bb;
public ByteBuffer ByteBuffer { get { return bb; } } public ByteBuffer ByteBuffer { get { return bb; } }
// Look up a field in the vtable, return an offset into the object, or 0 if the field is not // Look up a field in the vtable, return an offset into the object, or 0 if the field is not
// present. // present.
protected int __offset(int vtableOffset) public int __offset(int vtableOffset)
{ {
int vtable = bb_pos - bb.GetInt(bb_pos); int vtable = bb_pos - bb.GetInt(bb_pos);
return vtableOffset < bb.GetShort(vtable) ? (int)bb.GetShort(vtable + vtableOffset) : 0; return vtableOffset < bb.GetShort(vtable) ? (int)bb.GetShort(vtable + vtableOffset) : 0;
} }
protected static int __offset(int vtableOffset, int offset, ByteBuffer bb) public static int __offset(int vtableOffset, int offset, ByteBuffer bb)
{ {
int vtable = bb.Length - offset; int vtable = bb.Length - offset;
return (int)bb.GetShort(vtable + vtableOffset - bb.GetInt(vtable)) + vtable; return (int)bb.GetShort(vtable + vtableOffset - bb.GetInt(vtable)) + vtable;
} }
// Retrieve the relative offset stored at "offset" // Retrieve the relative offset stored at "offset"
protected int __indirect(int offset) public int __indirect(int offset)
{ {
return offset + bb.GetInt(offset); return offset + bb.GetInt(offset);
} }
protected static int __indirect(int offset, ByteBuffer bb) public static int __indirect(int offset, ByteBuffer bb)
{ {
return offset + bb.GetInt(offset); return offset + bb.GetInt(offset);
} }
// Create a .NET String from UTF-8 data stored inside the flatbuffer. // Create a .NET String from UTF-8 data stored inside the flatbuffer.
protected string __string(int offset) public string __string(int offset)
{ {
offset += bb.GetInt(offset); offset += bb.GetInt(offset);
var len = bb.GetInt(offset); var len = bb.GetInt(offset);
...@@ -64,7 +64,7 @@ namespace FlatBuffers ...@@ -64,7 +64,7 @@ namespace FlatBuffers
} }
// Get the length of a vector whose offset is stored at "offset" in this object. // Get the length of a vector whose offset is stored at "offset" in this object.
protected int __vector_len(int offset) public int __vector_len(int offset)
{ {
offset += bb_pos; offset += bb_pos;
offset += bb.GetInt(offset); offset += bb.GetInt(offset);
...@@ -72,7 +72,7 @@ namespace FlatBuffers ...@@ -72,7 +72,7 @@ namespace FlatBuffers
} }
// Get the start of data of a vector whose offset is stored at "offset" in this object. // Get the start of data of a vector whose offset is stored at "offset" in this object.
protected int __vector(int offset) public int __vector(int offset)
{ {
offset += bb_pos; offset += bb_pos;
return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length
...@@ -81,7 +81,8 @@ namespace FlatBuffers ...@@ -81,7 +81,8 @@ namespace FlatBuffers
// Get the data of a vector whoses offset is stored at "offset" in this object as an // Get the data of a vector whoses offset is stored at "offset" in this object as an
// ArraySegment&lt;byte&gt;. If the vector is not present in the ByteBuffer, // ArraySegment&lt;byte&gt;. If the vector is not present in the ByteBuffer,
// then a null value will be returned. // then a null value will be returned.
protected ArraySegment<byte>? __vector_as_arraysegment(int offset) { public ArraySegment<byte>? __vector_as_arraysegment(int offset)
{
var o = this.__offset(offset); var o = this.__offset(offset);
if (0 == o) if (0 == o)
{ {
...@@ -94,15 +95,15 @@ namespace FlatBuffers ...@@ -94,15 +95,15 @@ namespace FlatBuffers
} }
// Initialize any Table-derived type to point to the union at the given offset. // Initialize any Table-derived type to point to the union at the given offset.
protected TTable __union<TTable>(TTable t, int offset) where TTable : Table public T __union<T>(int offset) where T : struct, IFlatbufferObject
{ {
offset += bb_pos; offset += bb_pos;
t.bb_pos = offset + bb.GetInt(offset); T t = new T();
t.bb = bb; t.__init(offset + bb.GetInt(offset), bb);
return t; return t;
} }
protected static bool __has_identifier(ByteBuffer bb, string ident) public static bool __has_identifier(ByteBuffer bb, string ident)
{ {
if (ident.Length != FlatBufferConstants.FileIdentifierLength) if (ident.Length != FlatBufferConstants.FileIdentifierLength)
throw new ArgumentException("FlatBuffers: file identifier must be length " + FlatBufferConstants.FileIdentifierLength, "ident"); throw new ArgumentException("FlatBuffers: file identifier must be length " + FlatBufferConstants.FileIdentifierLength, "ident");
...@@ -114,9 +115,9 @@ namespace FlatBuffers ...@@ -114,9 +115,9 @@ namespace FlatBuffers
return true; return true;
} }
// Compare strings in the ByteBuffer. // Compare strings in the ByteBuffer.
protected static int CompareStrings(int offset_1, int offset_2, ByteBuffer bb) public static int CompareStrings(int offset_1, int offset_2, ByteBuffer bb)
{ {
offset_1 += bb.GetInt(offset_1); offset_1 += bb.GetInt(offset_1);
offset_2 += bb.GetInt(offset_2); offset_2 += bb.GetInt(offset_2);
...@@ -132,9 +133,9 @@ namespace FlatBuffers ...@@ -132,9 +133,9 @@ namespace FlatBuffers
} }
return len_1 - len_2; return len_1 - len_2;
} }
// Compare string from the ByteBuffer with the string object // Compare string from the ByteBuffer with the string object
protected static int CompareStrings(int offset_1, byte[] key, ByteBuffer bb) public static int CompareStrings(int offset_1, byte[] key, ByteBuffer bb)
{ {
offset_1 += bb.GetInt(offset_1); offset_1 += bb.GetInt(offset_1);
var len_1 = bb.GetInt(offset_1); var len_1 = bb.GetInt(offset_1);
...@@ -148,6 +149,5 @@ namespace FlatBuffers ...@@ -148,6 +149,5 @@ namespace FlatBuffers
} }
return len_1 - len_2; return len_1 - len_2;
} }
} }
} }
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs"> <Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
<Link>FlatBuffers\ByteBuffer.cs</Link> <Link>FlatBuffers\ByteBuffer.cs</Link>
</Compile> </Compile>
<Compile Include="..\..\net\FlatBuffers\IFlatbufferObject .cs">
<Link>FlatBuffers\IFlatbufferObject .cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Offset.cs"> <Compile Include="..\..\net\FlatBuffers\Offset.cs">
<Link>FlatBuffers\Offset.cs</Link> <Link>FlatBuffers\Offset.cs</Link>
</Compile> </Compile>
......
...@@ -51,7 +51,7 @@ namespace FlatBuffers.Test ...@@ -51,7 +51,7 @@ namespace FlatBuffers.Test
Monster.AddName(fbb, names[2]); Monster.AddName(fbb, names[2]);
off[2] = Monster.EndMonster(fbb); off[2] = Monster.EndMonster(fbb);
var sortMons = Monster.CreateMySortedVectorOfTables(fbb, off); var sortMons = Monster.CreateMySortedVectorOfTables(fbb, off);
// We set up the same values as monsterdata.json: // We set up the same values as monsterdata.json:
var str = fbb.CreateString("MyMonster"); var str = fbb.CreateString("MyMonster");
...@@ -116,12 +116,12 @@ namespace FlatBuffers.Test ...@@ -116,12 +116,12 @@ namespace FlatBuffers.Test
// the mana field should retain its default value // the mana field should retain its default value
Assert.AreEqual(monster.MutateMana((short)10), false); Assert.AreEqual(monster.MutateMana((short)10), false);
Assert.AreEqual(monster.Mana, (short)150); Assert.AreEqual(monster.Mana, (short)150);
// Accessing a vector of sorted by the key tables // Accessing a vector of sorted by the key tables
Assert.AreEqual(monster.GetTestarrayoftables(0).Name, "Barney"); Assert.AreEqual(monster.Testarrayoftables(0).Value.Name, "Barney");
Assert.AreEqual(monster.GetTestarrayoftables(1).Name, "Frodo"); Assert.AreEqual(monster.Testarrayoftables(1).Value.Name, "Frodo");
Assert.AreEqual(monster.GetTestarrayoftables(2).Name, "Wilma"); Assert.AreEqual(monster.Testarrayoftables(2).Value.Name, "Wilma");
// Example of searching for a table by the key // Example of searching for a table by the key
Assert.IsTrue(Monster.LookupByKey(sortMons, "Frodo", fbb.DataBuffer) != null); Assert.IsTrue(Monster.LookupByKey(sortMons, "Frodo", fbb.DataBuffer) != null);
Assert.IsTrue(Monster.LookupByKey(sortMons, "Barney", fbb.DataBuffer) != null); Assert.IsTrue(Monster.LookupByKey(sortMons, "Barney", fbb.DataBuffer) != null);
...@@ -143,7 +143,7 @@ namespace FlatBuffers.Test ...@@ -143,7 +143,7 @@ namespace FlatBuffers.Test
for (int i = 0; i < monster.InventoryLength; i++) for (int i = 0; i < monster.InventoryLength; i++)
{ {
Assert.AreEqual(monster.GetInventory(i), i + 1); Assert.AreEqual(monster.Inventory(i), i + 1);
} }
//reverse mutation //reverse mutation
...@@ -154,7 +154,7 @@ namespace FlatBuffers.Test ...@@ -154,7 +154,7 @@ namespace FlatBuffers.Test
Assert.AreEqual(monster.MutateInventory(4, 4), true); Assert.AreEqual(monster.MutateInventory(4, 4), true);
// get a struct field and edit one of its fields // get a struct field and edit one of its fields
Vec3 pos = monster.Pos; Vec3 pos = (Vec3)monster.Pos;
Assert.AreEqual(pos.X, 1.0f); Assert.AreEqual(pos.X, 1.0f);
pos.MutateX(55.0f); pos.MutateX(55.0f);
Assert.AreEqual(pos.X, 55.0f); Assert.AreEqual(pos.X, 55.0f);
...@@ -172,21 +172,20 @@ namespace FlatBuffers.Test ...@@ -172,21 +172,20 @@ namespace FlatBuffers.Test
Assert.AreEqual(150, monster.Mana); Assert.AreEqual(150, monster.Mana);
Assert.AreEqual("MyMonster", monster.Name); Assert.AreEqual("MyMonster", monster.Name);
var pos = monster.Pos; var pos = monster.Pos.Value;
Assert.AreEqual(1.0f, pos.X); Assert.AreEqual(1.0f, pos.X);
Assert.AreEqual(2.0f, pos.Y); Assert.AreEqual(2.0f, pos.Y);
Assert.AreEqual(3.0f, pos.Z); Assert.AreEqual(3.0f, pos.Z);
Assert.AreEqual(3.0f, pos.Test1); Assert.AreEqual(3.0f, pos.Test1);
Assert.AreEqual(Color.Green, pos.Test2); Assert.AreEqual(Color.Green, pos.Test2);
var t = pos.Test3; var t = (MyGame.Example.Test)pos.Test3;
Assert.AreEqual((short)5, t.A); Assert.AreEqual((short)5, t.A);
Assert.AreEqual((sbyte)6, t.B); Assert.AreEqual((sbyte)6, t.B);
Assert.AreEqual(Any.Monster, monster.TestType); Assert.AreEqual(Any.Monster, monster.TestType);
var monster2 = new Monster(); var monster2 = monster.Test<Monster>().Value;
Assert.IsTrue(monster.GetTest(monster2) != null);
Assert.AreEqual("Fred", monster2.Name); Assert.AreEqual("Fred", monster2.Name);
...@@ -194,19 +193,19 @@ namespace FlatBuffers.Test ...@@ -194,19 +193,19 @@ namespace FlatBuffers.Test
var invsum = 0; var invsum = 0;
for (var i = 0; i < monster.InventoryLength; i++) for (var i = 0; i < monster.InventoryLength; i++)
{ {
invsum += monster.GetInventory(i); invsum += monster.Inventory(i);
} }
Assert.AreEqual(10, invsum); Assert.AreEqual(10, invsum);
var test0 = monster.GetTest4(0); var test0 = monster.Test4(0).Value;
var test1 = monster.GetTest4(1); var test1 = monster.Test4(1).Value;
Assert.AreEqual(2, monster.Test4Length); Assert.AreEqual(2, monster.Test4Length);
Assert.AreEqual(100, test0.A + test0.B + test1.A + test1.B); Assert.AreEqual(100, test0.A + test0.B + test1.A + test1.B);
Assert.AreEqual(2, monster.TestarrayofstringLength); Assert.AreEqual(2, monster.TestarrayofstringLength);
Assert.AreEqual("test1", monster.GetTestarrayofstring(0)); Assert.AreEqual("test1", monster.Testarrayofstring(0));
Assert.AreEqual("test2", monster.GetTestarrayofstring(1)); Assert.AreEqual("test2", monster.Testarrayofstring(1));
Assert.AreEqual(false, monster.Testbool); Assert.AreEqual(false, monster.Testbool);
...@@ -269,10 +268,10 @@ namespace FlatBuffers.Test ...@@ -269,10 +268,10 @@ namespace FlatBuffers.Test
Monster.AddTestnestedflatbuffer(fbb2, nestedBuffer); Monster.AddTestnestedflatbuffer(fbb2, nestedBuffer);
var monster = Monster.EndMonster(fbb2); var monster = Monster.EndMonster(fbb2);
Monster.FinishMonsterBuffer(fbb2, monster); Monster.FinishMonsterBuffer(fbb2, monster);
// Now test the data extracted from the nested buffer // Now test the data extracted from the nested buffer
var mons = Monster.GetRootAsMonster(fbb2.DataBuffer); var mons = Monster.GetRootAsMonster(fbb2.DataBuffer);
var nestedMonster = mons.TestnestedflatbufferAsMonster(); var nestedMonster = mons.GetTestnestedflatbufferAsMonster().Value;
Assert.AreEqual(nestedMonsterMana, nestedMonster.Mana); Assert.AreEqual(nestedMonsterMana, nestedMonster.Mana);
Assert.AreEqual(nestedMonsterHp, nestedMonster.Hp); Assert.AreEqual(nestedMonsterHp, nestedMonster.Hp);
......
...@@ -19,133 +19,135 @@ namespace FlatBuffers.Test ...@@ -19,133 +19,135 @@ namespace FlatBuffers.Test
/// <summary> /// <summary>
/// A test Table object that gives easy access to the slot data /// A test Table object that gives easy access to the slot data
/// </summary> /// </summary>
internal class TestTable : Table internal struct TestTable
{ {
Table t;
public TestTable(ByteBuffer bb, int pos) public TestTable(ByteBuffer bb, int pos)
{ {
base.bb = bb; t.bb = bb;
base.bb_pos = pos; t.bb_pos = pos;
} }
public bool GetSlot(int slot, bool def) public bool GetSlot(int slot, bool def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetSbyte(bb_pos + off) != 0; return t.bb.GetSbyte(t.bb_pos + off) != 0;
} }
public sbyte GetSlot(int slot, sbyte def) public sbyte GetSlot(int slot, sbyte def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetSbyte(bb_pos + off); return t.bb.GetSbyte(t.bb_pos + off);
} }
public byte GetSlot(int slot, byte def) public byte GetSlot(int slot, byte def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.Get(bb_pos + off); return t.bb.Get(t.bb_pos + off);
} }
public short GetSlot(int slot, short def) public short GetSlot(int slot, short def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetShort(bb_pos + off); return t.bb.GetShort(t.bb_pos + off);
} }
public ushort GetSlot(int slot, ushort def) public ushort GetSlot(int slot, ushort def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetUshort(bb_pos + off); return t.bb.GetUshort(t.bb_pos + off);
} }
public int GetSlot(int slot, int def) public int GetSlot(int slot, int def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetInt(bb_pos + off); return t.bb.GetInt(t.bb_pos + off);
} }
public uint GetSlot(int slot, uint def) public uint GetSlot(int slot, uint def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetUint(bb_pos + off); return t.bb.GetUint(t.bb_pos + off);
} }
public long GetSlot(int slot, long def) public long GetSlot(int slot, long def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetLong(bb_pos + off); return t.bb.GetLong(t.bb_pos + off);
} }
public ulong GetSlot(int slot, ulong def) public ulong GetSlot(int slot, ulong def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetUlong(bb_pos + off); return t.bb.GetUlong(t.bb_pos + off);
} }
public float GetSlot(int slot, float def) public float GetSlot(int slot, float def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetFloat(bb_pos + off); return t.bb.GetFloat(t.bb_pos + off);
} }
public double GetSlot(int slot, double def) public double GetSlot(int slot, double def)
{ {
var off = base.__offset(slot); var off = t.__offset(slot);
if (off == 0) if (off == 0)
{ {
return def; return def;
} }
return bb.GetDouble(bb_pos + off); return t.bb.GetDouble(t.bb_pos + off);
} }
} }
} }
\ No newline at end of file
This diff is collapsed.
...@@ -13,12 +13,13 @@ import com.google.flatbuffers.*; ...@@ -13,12 +13,13 @@ import com.google.flatbuffers.*;
*/ */
public final class Monster extends Table { public final class Monster extends Table {
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); } public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); } public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); }
public Monster __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public Vec3 pos() { return pos(new Vec3()); } 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 Vec3 pos(Vec3 obj) { int o = __offset(4); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
public short mana() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) : 150; } public short mana() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) : 150; }
public boolean mutateMana(short mana) { int o = __offset(6); if (o != 0) { bb.putShort(o + bb_pos, mana); return true; } else { return false; } } public boolean mutateMana(short mana) { int o = __offset(6); if (o != 0) { bb.putShort(o + bb_pos, mana); return true; } else { return false; } }
public short hp() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 100; } public short hp() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 100; }
...@@ -35,7 +36,7 @@ public final class Monster extends Table { ...@@ -35,7 +36,7 @@ public final class Monster extends Table {
public boolean mutateTestType(byte test_type) { int o = __offset(18); if (o != 0) { bb.put(o + bb_pos, test_type); return true; } else { return false; } } public boolean mutateTestType(byte test_type) { int o = __offset(18); if (o != 0) { bb.put(o + bb_pos, test_type); return true; } else { return false; } }
public Table test(Table obj) { int o = __offset(20); return o != 0 ? __union(obj, o) : null; } 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(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 Test test4(Test obj, int j) { int o = __offset(22); return o != 0 ? obj.__assign(__vector(o) + j * 4, bb) : null; }
public int test4Length() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; } public int test4Length() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; }
public String testarrayofstring(int j) { int o = __offset(24); return o != 0 ? __string(__vector(o) + j * 4) : null; } public String testarrayofstring(int j) { int o = __offset(24); return o != 0 ? __string(__vector(o) + j * 4) : null; }
public int testarrayofstringLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; } public int testarrayofstringLength() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; }
...@@ -44,18 +45,18 @@ public final class Monster extends Table { ...@@ -44,18 +45,18 @@ public final class Monster extends Table {
* multiline too * multiline too
*/ */
public Monster testarrayoftables(int j) { return testarrayoftables(new Monster(), j); } public Monster testarrayoftables(int j) { return testarrayoftables(new Monster(), j); }
public Monster testarrayoftables(Monster obj, int j) { int o = __offset(26); return o != 0 ? obj.__init(__indirect(__vector(o) + j * 4), bb) : null; } public Monster testarrayoftables(Monster obj, int j) { int o = __offset(26); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
public int testarrayoftablesLength() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; } public int testarrayoftablesLength() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; }
public Monster enemy() { return enemy(new Monster()); } public Monster enemy() { return enemy(new Monster()); }
public Monster enemy(Monster obj) { int o = __offset(28); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public Monster enemy(Monster obj) { int o = __offset(28); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public int testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; } public int testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; }
public int testnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; } public int testnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; }
public ByteBuffer testnestedflatbufferAsByteBuffer() { return __vector_as_bytebuffer(30, 1); } public ByteBuffer testnestedflatbufferAsByteBuffer() { return __vector_as_bytebuffer(30, 1); }
public Monster testnestedflatbufferAsMonster() { return testnestedflatbufferAsMonster(new Monster()); } public Monster testnestedflatbufferAsMonster() { return testnestedflatbufferAsMonster(new Monster()); }
public Monster testnestedflatbufferAsMonster(Monster obj) { int o = __offset(30); return o != 0 ? obj.__init(__indirect(__vector(o)), bb) : null; } public Monster testnestedflatbufferAsMonster(Monster obj) { int o = __offset(30); return o != 0 ? obj.__assign(__indirect(__vector(o)), bb) : null; }
public boolean mutateTestnestedflatbuffer(int j, int testnestedflatbuffer) { int o = __offset(30); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)testnestedflatbuffer); return true; } else { return false; } } public boolean mutateTestnestedflatbuffer(int j, int testnestedflatbuffer) { int o = __offset(30); if (o != 0) { bb.put(__vector(o) + j * 1, (byte)testnestedflatbuffer); return true; } else { return false; } }
public Stat testempty() { return testempty(new Stat()); } public Stat testempty() { return testempty(new Stat()); }
public Stat testempty(Stat obj) { int o = __offset(32); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public Stat testempty(Stat obj) { int o = __offset(32); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public boolean testbool() { int o = __offset(34); return o != 0 ? 0!=bb.get(o + bb_pos) : false; } public boolean testbool() { int o = __offset(34); return o != 0 ? 0!=bb.get(o + bb_pos) : false; }
public boolean mutateTestbool(boolean testbool) { int o = __offset(34); if (o != 0) { bb.put(o + bb_pos, (byte)(testbool ? 1 : 0)); return true; } else { return false; } } public boolean mutateTestbool(boolean testbool) { int o = __offset(34); if (o != 0) { bb.put(o + bb_pos, (byte)(testbool ? 1 : 0)); return true; } else { return false; } }
public int testhashs32Fnv1() { int o = __offset(36); return o != 0 ? bb.getInt(o + bb_pos) : 0; } public int testhashs32Fnv1() { int o = __offset(36); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
...@@ -156,7 +157,7 @@ public final class Monster extends Table { ...@@ -156,7 +157,7 @@ public final class Monster extends Table {
start += middle; start += middle;
span -= middle; span -= middle;
} else { } else {
return new Monster().__init(tableOffset, bb); return new Monster().__assign(tableOffset, bb);
} }
} }
return null; return null;
......
...@@ -6,17 +6,20 @@ namespace MyGame.Example ...@@ -6,17 +6,20 @@ namespace MyGame.Example
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class Stat : Table { public struct Stat : IFlatbufferObject
{
private Table __p;
public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); } public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); }
public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public Stat __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public string Id { get { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } }
public ArraySegment<byte>? GetIdBytes() { return __vector_as_arraysegment(4); } public string Id { get { int o = __p.__offset(4); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
public long Val { get { int o = __offset(6); return o != 0 ? bb.GetLong(o + bb_pos) : (long)0; } } public ArraySegment<byte>? GetIdBytes() { return __p.__vector_as_arraysegment(4); }
public bool MutateVal(long val) { int o = __offset(6); if (o != 0) { bb.PutLong(o + bb_pos, val); return true; } else { return false; } } public long Val { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetLong(o + __p.bb_pos) : (long)0; } }
public ushort Count { get { int o = __offset(8); return o != 0 ? bb.GetUshort(o + bb_pos) : (ushort)0; } } public bool MutateVal(long val) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutLong(o + __p.bb_pos, val); return true; } else { return false; } }
public bool MutateCount(ushort count) { int o = __offset(8); if (o != 0) { bb.PutUshort(o + bb_pos, count); return true; } else { return false; } } public ushort Count { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetUshort(o + __p.bb_pos) : (ushort)0; } }
public bool MutateCount(ushort count) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutUshort(o + __p.bb_pos, count); return true; } else { return false; } }
public static Offset<Stat> CreateStat(FlatBufferBuilder builder, public static Offset<Stat> CreateStat(FlatBufferBuilder builder,
StringOffset idOffset = default(StringOffset), StringOffset idOffset = default(StringOffset),
......
...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*; ...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Stat extends Table { public final class Stat extends Table {
public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); } public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public Stat __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public Stat __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; } public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); } public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
......
...@@ -6,13 +6,16 @@ namespace MyGame.Example ...@@ -6,13 +6,16 @@ namespace MyGame.Example
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class Test : Struct { public struct Test : IFlatbufferObject
public Test __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } {
private Struct __p;
public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public Test __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public short A { get { return bb.GetShort(bb_pos + 0); } } public short A { get { return __p.bb.GetShort(__p.bb_pos + 0); } }
public void MutateA(short a) { bb.PutShort(bb_pos + 0, a); } public void MutateA(short a) { __p.bb.PutShort(__p.bb_pos + 0, a); }
public sbyte B { get { return bb.GetSbyte(bb_pos + 2); } } public sbyte B { get { return __p.bb.GetSbyte(__p.bb_pos + 2); } }
public void MutateB(sbyte b) { bb.PutSbyte(bb_pos + 2, b); } public void MutateB(sbyte b) { __p.bb.PutSbyte(__p.bb_pos + 2, b); }
public static Offset<Test> CreateTest(FlatBufferBuilder builder, short A, sbyte B) { public static Offset<Test> CreateTest(FlatBufferBuilder builder, short A, sbyte B) {
builder.Prep(2, 4); builder.Prep(2, 4);
......
...@@ -9,7 +9,8 @@ import com.google.flatbuffers.*; ...@@ -9,7 +9,8 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Test extends Struct { public final class Test extends Struct {
public Test __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public Test __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public short a() { return bb.getShort(bb_pos + 0); } public short a() { return bb.getShort(bb_pos + 0); }
public void mutateA(short a) { bb.putShort(bb_pos + 0, a); } public void mutateA(short a) { bb.putShort(bb_pos + 0, a); }
......
...@@ -6,13 +6,16 @@ namespace MyGame.Example ...@@ -6,13 +6,16 @@ namespace MyGame.Example
using System; using System;
using FlatBuffers; using FlatBuffers;
public partial class TestSimpleTableWithEnum : Table { public partial struct TestSimpleTableWithEnum : IFlatbufferObject
{
private Table __p;
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return GetRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); } public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return GetRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public TestSimpleTableWithEnum __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public TestSimpleTableWithEnum __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public Color Color { get { int o = __offset(4); return o != 0 ? (Color)bb.GetSbyte(o + bb_pos) : Color.Green; } } public Color Color { get { int o = __p.__offset(4); return o != 0 ? (Color)__p.bb.GetSbyte(o + __p.bb_pos) : Color.Green; } }
public bool MutateColor(Color color) { int o = __offset(4); if (o != 0) { bb.PutSbyte(o + bb_pos, (sbyte)color); return true; } else { return false; } } public bool MutateColor(Color color) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutSbyte(o + __p.bb_pos, (sbyte)color); return true; } else { return false; } }
public static Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(FlatBufferBuilder builder, public static Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(FlatBufferBuilder builder,
Color color = Color.Green) { Color color = Color.Green) {
......
...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*; ...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class TestSimpleTableWithEnum extends Table { public final class TestSimpleTableWithEnum extends Table {
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); } public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public TestSimpleTableWithEnum __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public TestSimpleTableWithEnum __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public byte color() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 2; } public byte color() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 2; }
public boolean mutateColor(byte color) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, color); return true; } else { return false; } } public boolean mutateColor(byte color) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, color); return true; } else { return false; } }
......
...@@ -6,21 +6,23 @@ namespace MyGame.Example ...@@ -6,21 +6,23 @@ namespace MyGame.Example
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class Vec3 : Struct { public struct Vec3 : IFlatbufferObject
public Vec3 __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } {
private Struct __p;
public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public Vec3 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public float X { get { return bb.GetFloat(bb_pos + 0); } } public float X { get { return __p.bb.GetFloat(__p.bb_pos + 0); } }
public void MutateX(float x) { bb.PutFloat(bb_pos + 0, x); } public void MutateX(float x) { __p.bb.PutFloat(__p.bb_pos + 0, x); }
public float Y { get { return bb.GetFloat(bb_pos + 4); } } public float Y { get { return __p.bb.GetFloat(__p.bb_pos + 4); } }
public void MutateY(float y) { bb.PutFloat(bb_pos + 4, y); } public void MutateY(float y) { __p.bb.PutFloat(__p.bb_pos + 4, y); }
public float Z { get { return bb.GetFloat(bb_pos + 8); } } public float Z { get { return __p.bb.GetFloat(__p.bb_pos + 8); } }
public void MutateZ(float z) { bb.PutFloat(bb_pos + 8, z); } public void MutateZ(float z) { __p.bb.PutFloat(__p.bb_pos + 8, z); }
public double Test1 { get { return bb.GetDouble(bb_pos + 16); } } public double Test1 { get { return __p.bb.GetDouble(__p.bb_pos + 16); } }
public void MutateTest1(double test1) { bb.PutDouble(bb_pos + 16, test1); } public void MutateTest1(double test1) { __p.bb.PutDouble(__p.bb_pos + 16, test1); }
public Color Test2 { get { return (Color)bb.GetSbyte(bb_pos + 24); } } public Color Test2 { get { return (Color)__p.bb.GetSbyte(__p.bb_pos + 24); } }
public void MutateTest2(Color test2) { bb.PutSbyte(bb_pos + 24, (sbyte)test2); } public void MutateTest2(Color test2) { __p.bb.PutSbyte(__p.bb_pos + 24, (sbyte)test2); }
public Test Test3 { get { return GetTest3(new Test()); } } public Test Test3 { get { return (new Test()).__assign(__p.bb_pos + 26, __p.bb); } }
public Test GetTest3(Test obj) { return obj.__init(bb_pos + 26, bb); }
public static Offset<Vec3> CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, Color Test2, short test3_A, sbyte test3_B) { public static Offset<Vec3> CreateVec3(FlatBufferBuilder builder, float X, float Y, float Z, double Test1, Color Test2, short test3_A, sbyte test3_B) {
builder.Prep(16, 32); builder.Prep(16, 32);
......
...@@ -9,7 +9,8 @@ import com.google.flatbuffers.*; ...@@ -9,7 +9,8 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Vec3 extends Struct { public final class Vec3 extends Struct {
public Vec3 __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public Vec3 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public float x() { return bb.getFloat(bb_pos + 0); } public float x() { return bb.getFloat(bb_pos + 0); }
public void mutateX(float x) { bb.putFloat(bb_pos + 0, x); } public void mutateX(float x) { bb.putFloat(bb_pos + 0, x); }
...@@ -22,7 +23,7 @@ public final class Vec3 extends Struct { ...@@ -22,7 +23,7 @@ public final class Vec3 extends Struct {
public byte test2() { return bb.get(bb_pos + 24); } public byte test2() { return bb.get(bb_pos + 24); }
public void mutateTest2(byte test2) { bb.put(bb_pos + 24, test2); } public void mutateTest2(byte test2) { bb.put(bb_pos + 24, test2); }
public Test test3() { return test3(new Test()); } public Test test3() { return test3(new Test()); }
public Test test3(Test obj) { return obj.__init(bb_pos + 26, bb); } public Test test3(Test obj) { return obj.__assign(bb_pos + 26, bb); }
public static int createVec3(FlatBufferBuilder builder, float x, float y, float z, double test1, byte test2, short test3_a, byte test3_b) { public static int createVec3(FlatBufferBuilder builder, float x, float y, float z, double test1, byte test2, short test3_a, byte test3_b) {
builder.prep(16, 32); builder.prep(16, 32);
......
...@@ -6,10 +6,13 @@ namespace MyGame.Example2 ...@@ -6,10 +6,13 @@ namespace MyGame.Example2
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class Monster : Table { public struct Monster : IFlatbufferObject
{
private Table __p;
public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); } public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); }
public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public Monster __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(0); } public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(0); }
......
...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*; ...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Monster extends Table { public final class Monster extends Table {
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); } public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public Monster __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public Monster __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public static void startMonster(FlatBufferBuilder builder) { builder.startObject(0); } public static void startMonster(FlatBufferBuilder builder) { builder.startObject(0); }
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
:: See the License for the specific language governing permissions and :: See the License for the specific language governing permissions and
:: limitations under the License. :: limitations under the License.
..\flatc.exe --cpp --java --csharp --go --binary --python --js --php --grpc --gen-mutable --gen-object-api --no-includes monster_test.fbs monsterdata_test.json set buildtype=Release
..\flatc.exe --cpp --java --csharp --go --binary --python --js --php --gen-mutable -o namespace_test namespace_test\namespace_test1.fbs namespace_test\namespace_test2.fbs if "%1"=="-b" set buildtype=%2
..\flatc.exe --binary --schema monster_test.fbs
..\%buildtype%\flatc.exe --cpp --java --csharp --go --binary --python --js --php --grpc --gen-mutable --gen-object-api --no-includes monster_test.fbs monsterdata_test.json
..\%buildtype%\flatc.exe --cpp --java --csharp --go --binary --python --js --php --gen-mutable -o namespace_test namespace_test\namespace_test1.fbs namespace_test\namespace_test2.fbs
..\%buildtype%\flatc.exe --binary --schema monster_test.fbs
...@@ -6,13 +6,16 @@ namespace NamespaceA.NamespaceB ...@@ -6,13 +6,16 @@ namespace NamespaceA.NamespaceB
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class StructInNestedNS : Struct { public struct StructInNestedNS : IFlatbufferObject
public StructInNestedNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } {
private Struct __p;
public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public StructInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public int A { get { return bb.GetInt(bb_pos + 0); } } public int A { get { return __p.bb.GetInt(__p.bb_pos + 0); } }
public void MutateA(int a) { bb.PutInt(bb_pos + 0, a); } public void MutateA(int a) { __p.bb.PutInt(__p.bb_pos + 0, a); }
public int B { get { return bb.GetInt(bb_pos + 4); } } public int B { get { return __p.bb.GetInt(__p.bb_pos + 4); } }
public void MutateB(int b) { bb.PutInt(bb_pos + 4, b); } public void MutateB(int b) { __p.bb.PutInt(__p.bb_pos + 4, b); }
public static Offset<StructInNestedNS> CreateStructInNestedNS(FlatBufferBuilder builder, int A, int B) { public static Offset<StructInNestedNS> CreateStructInNestedNS(FlatBufferBuilder builder, int A, int B) {
builder.Prep(4, 8); builder.Prep(4, 8);
......
...@@ -9,7 +9,8 @@ import com.google.flatbuffers.*; ...@@ -9,7 +9,8 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class StructInNestedNS extends Struct { public final class StructInNestedNS extends Struct {
public StructInNestedNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public StructInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public int a() { return bb.getInt(bb_pos + 0); } public int a() { return bb.getInt(bb_pos + 0); }
public void mutateA(int a) { bb.putInt(bb_pos + 0, a); } public void mutateA(int a) { bb.putInt(bb_pos + 0, a); }
......
...@@ -6,13 +6,16 @@ namespace NamespaceA.NamespaceB ...@@ -6,13 +6,16 @@ namespace NamespaceA.NamespaceB
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class TableInNestedNS : Table { public struct TableInNestedNS : IFlatbufferObject
{
private Table __p;
public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb) { return GetRootAsTableInNestedNS(_bb, new TableInNestedNS()); } public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb) { return GetRootAsTableInNestedNS(_bb, new TableInNestedNS()); }
public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public TableInNestedNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public TableInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public int Foo { get { int o = __offset(4); return o != 0 ? bb.GetInt(o + bb_pos) : (int)0; } } public int Foo { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
public bool MutateFoo(int foo) { int o = __offset(4); if (o != 0) { bb.PutInt(o + bb_pos, foo); return true; } else { return false; } } public bool MutateFoo(int foo) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, foo); return true; } else { return false; } }
public static Offset<TableInNestedNS> CreateTableInNestedNS(FlatBufferBuilder builder, public static Offset<TableInNestedNS> CreateTableInNestedNS(FlatBufferBuilder builder,
int foo = 0) { int foo = 0) {
......
...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*; ...@@ -10,8 +10,9 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class TableInNestedNS extends Table { public final class TableInNestedNS extends Table {
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb) { return getRootAsTableInNestedNS(_bb, new TableInNestedNS()); } public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb) { return getRootAsTableInNestedNS(_bb, new TableInNestedNS()); }
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public TableInNestedNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public TableInNestedNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public int foo() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; } public int foo() { int o = __offset(4); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
public boolean mutateFoo(int foo) { int o = __offset(4); if (o != 0) { bb.putInt(o + bb_pos, foo); return true; } else { return false; } } public boolean mutateFoo(int foo) { int o = __offset(4); if (o != 0) { bb.putInt(o + bb_pos, foo); return true; } else { return false; } }
......
...@@ -6,13 +6,15 @@ namespace NamespaceA ...@@ -6,13 +6,15 @@ namespace NamespaceA
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class SecondTableInA : Table { public struct SecondTableInA : IFlatbufferObject
{
private Table __p;
public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb) { return GetRootAsSecondTableInA(_bb, new SecondTableInA()); } public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb) { return GetRootAsSecondTableInA(_bb, new SecondTableInA()); }
public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public SecondTableInA __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public SecondTableInA __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public NamespaceC.TableInC ReferToC { get { return GetReferToC(new NamespaceC.TableInC()); } } public NamespaceC.TableInC? ReferToC { get { int o = __p.__offset(4); return o != 0 ? (NamespaceC.TableInC?)(new NamespaceC.TableInC()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
public NamespaceC.TableInC GetReferToC(NamespaceC.TableInC obj) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
public static Offset<SecondTableInA> CreateSecondTableInA(FlatBufferBuilder builder, public static Offset<SecondTableInA> CreateSecondTableInA(FlatBufferBuilder builder,
Offset<NamespaceC.TableInC> refer_to_cOffset = default(Offset<NamespaceC.TableInC>)) { Offset<NamespaceC.TableInC> refer_to_cOffset = default(Offset<NamespaceC.TableInC>)) {
......
...@@ -10,11 +10,12 @@ import com.google.flatbuffers.*; ...@@ -10,11 +10,12 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class SecondTableInA extends Table { public final class SecondTableInA extends Table {
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb) { return getRootAsSecondTableInA(_bb, new SecondTableInA()); } public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb) { return getRootAsSecondTableInA(_bb, new SecondTableInA()); }
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public SecondTableInA __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public SecondTableInA __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public NamespaceC.TableInC referToC() { return referToC(new NamespaceC.TableInC()); } public NamespaceC.TableInC referToC() { return referToC(new NamespaceC.TableInC()); }
public NamespaceC.TableInC referToC(NamespaceC.TableInC obj) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public NamespaceC.TableInC referToC(NamespaceC.TableInC obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public static int createSecondTableInA(FlatBufferBuilder builder, public static int createSecondTableInA(FlatBufferBuilder builder,
int refer_to_cOffset) { int refer_to_cOffset) {
......
...@@ -6,17 +6,18 @@ namespace NamespaceA ...@@ -6,17 +6,18 @@ namespace NamespaceA
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class TableInFirstNS : Table { public struct TableInFirstNS : IFlatbufferObject
{
private Table __p;
public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb) { return GetRootAsTableInFirstNS(_bb, new TableInFirstNS()); } public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb) { return GetRootAsTableInFirstNS(_bb, new TableInFirstNS()); }
public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public TableInFirstNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public TableInFirstNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public NamespaceA.NamespaceB.TableInNestedNS FooTable { get { return GetFooTable(new NamespaceA.NamespaceB.TableInNestedNS()); } } public NamespaceA.NamespaceB.TableInNestedNS? FooTable { get { int o = __p.__offset(4); return o != 0 ? (NamespaceA.NamespaceB.TableInNestedNS?)(new NamespaceA.NamespaceB.TableInNestedNS()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
public NamespaceA.NamespaceB.TableInNestedNS GetFooTable(NamespaceA.NamespaceB.TableInNestedNS obj) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public NamespaceA.NamespaceB.EnumInNestedNS FooEnum { get { int o = __p.__offset(6); return o != 0 ? (NamespaceA.NamespaceB.EnumInNestedNS)__p.bb.GetSbyte(o + __p.bb_pos) : NamespaceA.NamespaceB.EnumInNestedNS.A; } }
public NamespaceA.NamespaceB.EnumInNestedNS FooEnum { get { int o = __offset(6); return o != 0 ? (NamespaceA.NamespaceB.EnumInNestedNS)bb.GetSbyte(o + bb_pos) : NamespaceA.NamespaceB.EnumInNestedNS.A; } } public bool MutateFooEnum(NamespaceA.NamespaceB.EnumInNestedNS foo_enum) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutSbyte(o + __p.bb_pos, (sbyte)foo_enum); return true; } else { return false; } }
public bool MutateFooEnum(NamespaceA.NamespaceB.EnumInNestedNS foo_enum) { int o = __offset(6); if (o != 0) { bb.PutSbyte(o + bb_pos, (sbyte)foo_enum); return true; } else { return false; } } public NamespaceA.NamespaceB.StructInNestedNS? FooStruct { get { int o = __p.__offset(8); return o != 0 ? (NamespaceA.NamespaceB.StructInNestedNS?)(new NamespaceA.NamespaceB.StructInNestedNS()).__assign(o + __p.bb_pos, __p.bb) : null; } }
public NamespaceA.NamespaceB.StructInNestedNS FooStruct { get { return GetFooStruct(new NamespaceA.NamespaceB.StructInNestedNS()); } }
public NamespaceA.NamespaceB.StructInNestedNS GetFooStruct(NamespaceA.NamespaceB.StructInNestedNS obj) { int o = __offset(8); return o != 0 ? obj.__init(o + bb_pos, bb) : null; }
public static void StartTableInFirstNS(FlatBufferBuilder builder) { builder.StartObject(3); } public static void StartTableInFirstNS(FlatBufferBuilder builder) { builder.StartObject(3); }
public static void AddFooTable(FlatBufferBuilder builder, Offset<NamespaceA.NamespaceB.TableInNestedNS> fooTableOffset) { builder.AddOffset(0, fooTableOffset.Value, 0); } public static void AddFooTable(FlatBufferBuilder builder, Offset<NamespaceA.NamespaceB.TableInNestedNS> fooTableOffset) { builder.AddOffset(0, fooTableOffset.Value, 0); }
......
...@@ -10,15 +10,16 @@ import com.google.flatbuffers.*; ...@@ -10,15 +10,16 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class TableInFirstNS extends Table { public final class TableInFirstNS extends Table {
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb) { return getRootAsTableInFirstNS(_bb, new TableInFirstNS()); } public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb) { return getRootAsTableInFirstNS(_bb, new TableInFirstNS()); }
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public TableInFirstNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public TableInFirstNS __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public NamespaceA.NamespaceB.TableInNestedNS fooTable() { return fooTable(new NamespaceA.NamespaceB.TableInNestedNS()); } public NamespaceA.NamespaceB.TableInNestedNS fooTable() { return fooTable(new NamespaceA.NamespaceB.TableInNestedNS()); }
public NamespaceA.NamespaceB.TableInNestedNS fooTable(NamespaceA.NamespaceB.TableInNestedNS obj) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public NamespaceA.NamespaceB.TableInNestedNS fooTable(NamespaceA.NamespaceB.TableInNestedNS obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public byte fooEnum() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; } public byte fooEnum() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) : 0; }
public boolean mutateFooEnum(byte foo_enum) { int o = __offset(6); if (o != 0) { bb.put(o + bb_pos, foo_enum); return true; } else { return false; } } public boolean mutateFooEnum(byte foo_enum) { int o = __offset(6); if (o != 0) { bb.put(o + bb_pos, foo_enum); return true; } else { return false; } }
public NamespaceA.NamespaceB.StructInNestedNS fooStruct() { return fooStruct(new NamespaceA.NamespaceB.StructInNestedNS()); } public NamespaceA.NamespaceB.StructInNestedNS fooStruct() { return fooStruct(new NamespaceA.NamespaceB.StructInNestedNS()); }
public NamespaceA.NamespaceB.StructInNestedNS fooStruct(NamespaceA.NamespaceB.StructInNestedNS obj) { int o = __offset(8); return o != 0 ? obj.__init(o + bb_pos, bb) : null; } public NamespaceA.NamespaceB.StructInNestedNS fooStruct(NamespaceA.NamespaceB.StructInNestedNS obj) { int o = __offset(8); return o != 0 ? obj.__assign(o + bb_pos, bb) : null; }
public static void startTableInFirstNS(FlatBufferBuilder builder) { builder.startObject(3); } public static void startTableInFirstNS(FlatBufferBuilder builder) { builder.startObject(3); }
public static void addFooTable(FlatBufferBuilder builder, int fooTableOffset) { builder.addOffset(0, fooTableOffset, 0); } public static void addFooTable(FlatBufferBuilder builder, int fooTableOffset) { builder.addOffset(0, fooTableOffset, 0); }
......
...@@ -6,15 +6,16 @@ namespace NamespaceC ...@@ -6,15 +6,16 @@ namespace NamespaceC
using System; using System;
using FlatBuffers; using FlatBuffers;
public sealed class TableInC : Table { public struct TableInC : IFlatbufferObject
{
private Table __p;
public static TableInC GetRootAsTableInC(ByteBuffer _bb) { return GetRootAsTableInC(_bb, new TableInC()); } public static TableInC GetRootAsTableInC(ByteBuffer _bb) { return GetRootAsTableInC(_bb, new TableInC()); }
public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public TableInC __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
public TableInC __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public NamespaceA.TableInFirstNS ReferToA1 { get { return GetReferToA1(new NamespaceA.TableInFirstNS()); } } public NamespaceA.TableInFirstNS? ReferToA1 { get { int o = __p.__offset(4); return o != 0 ? (NamespaceA.TableInFirstNS?)(new NamespaceA.TableInFirstNS()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
public NamespaceA.TableInFirstNS GetReferToA1(NamespaceA.TableInFirstNS obj) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public SecondTableInA? ReferToA2 { get { int o = __p.__offset(6); return o != 0 ? (SecondTableInA?)(new SecondTableInA()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } }
public SecondTableInA ReferToA2 { get { return GetReferToA2(new SecondTableInA()); } }
public SecondTableInA GetReferToA2(SecondTableInA obj) { int o = __offset(6); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
public static Offset<NamespaceC.TableInC> CreateTableInC(FlatBufferBuilder builder, public static Offset<NamespaceC.TableInC> CreateTableInC(FlatBufferBuilder builder,
Offset<NamespaceA.TableInFirstNS> refer_to_a1Offset = default(Offset<NamespaceA.TableInFirstNS>), Offset<NamespaceA.TableInFirstNS> refer_to_a1Offset = default(Offset<NamespaceA.TableInFirstNS>),
......
...@@ -10,13 +10,14 @@ import com.google.flatbuffers.*; ...@@ -10,13 +10,14 @@ import com.google.flatbuffers.*;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class TableInC extends Table { public final class TableInC extends Table {
public static TableInC getRootAsTableInC(ByteBuffer _bb) { return getRootAsTableInC(_bb, new TableInC()); } public static TableInC getRootAsTableInC(ByteBuffer _bb) { return getRootAsTableInC(_bb, new TableInC()); }
public static TableInC getRootAsTableInC(ByteBuffer _bb, TableInC obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } public static TableInC getRootAsTableInC(ByteBuffer _bb, TableInC obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public TableInC __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; } public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
public TableInC __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public NamespaceA.TableInFirstNS referToA1() { return referToA1(new NamespaceA.TableInFirstNS()); } public NamespaceA.TableInFirstNS referToA1() { return referToA1(new NamespaceA.TableInFirstNS()); }
public NamespaceA.TableInFirstNS referToA1(NamespaceA.TableInFirstNS obj) { int o = __offset(4); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public NamespaceA.TableInFirstNS referToA1(NamespaceA.TableInFirstNS obj) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public SecondTableInA referToA2() { return referToA2(new SecondTableInA()); } public SecondTableInA referToA2() { return referToA2(new SecondTableInA()); }
public SecondTableInA referToA2(SecondTableInA obj) { int o = __offset(6); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; } public SecondTableInA referToA2(SecondTableInA obj) { int o = __offset(6); return o != 0 ? obj.__assign(__indirect(o + bb_pos), bb) : null; }
public static int createTableInC(FlatBufferBuilder builder, public static int createTableInC(FlatBufferBuilder builder,
int refer_to_a1Offset, int refer_to_a1Offset,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment