diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2018-03-05 15:47:16 -0800 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2018-03-05 15:47:16 -0800 |
commit | 3a62813f0e147e9335cd69d8001f786b2d949832 (patch) | |
tree | 6451bf08e962feb31180a3744f1df73d105330d2 | |
parent | fb94af8899f2ebd338e9e256c067aea65b1e3a0e (diff) | |
download | flatbuffers-3a62813f0e147e9335cd69d8001f786b2d949832.tar.gz flatbuffers-3a62813f0e147e9335cd69d8001f786b2d949832.tar.bz2 flatbuffers-3a62813f0e147e9335cd69d8001f786b2d949832.zip |
Added missing generated code files.
Change-Id: Ie1cab284cb6e0fe5bd2b2c293c3136c148927ac3
-rw-r--r-- | tests/MyGame/Example/Monster.cs | 3 | ||||
-rw-r--r-- | tests/MyGame/Example/Monster.java | 3 | ||||
-rw-r--r-- | tests/MyGame/Example/Referrable.cs | 64 | ||||
-rw-r--r-- | tests/MyGame/Example/Referrable.go | 49 | ||||
-rw-r--r-- | tests/MyGame/Example/Referrable.java | 62 | ||||
-rw-r--r-- | tests/MyGame/Example/Referrable.php | 99 | ||||
-rw-r--r-- | tests/MyGame/Example/Referrable.py | 30 | ||||
-rw-r--r-- | tests/monster_test.bfbs | bin | 6112 -> 6104 bytes | |||
-rw-r--r-- | tests/namespace_test/namespace_test2_generated.ts | 20 |
9 files changed, 318 insertions, 12 deletions
diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs index 5c5bd6ae..a845ddad 100644 --- a/tests/MyGame/Example/Monster.cs +++ b/tests/MyGame/Example/Monster.cs @@ -111,7 +111,8 @@ public struct Monster : IFlatbufferObject public bool MutateVectorOfWeakReferences(int j, ulong vector_of_weak_references) { int o = __p.__offset(78); if (o != 0) { __p.bb.PutUlong(__p.__vector(o) + j * 8, vector_of_weak_references); return true; } else { return false; } } public Referrable? VectorOfStrongReferrables(int j) { int o = __p.__offset(80); return o != 0 ? (Referrable?)(new Referrable()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; } public int VectorOfStrongReferrablesLength { get { int o = __p.__offset(80); return o != 0 ? __p.__vector_len(o) : 0; } } - public Referrable? VectorOfStrongReferrablesByKey(ulong key) { int o = __p.__offset(80); return o != 0 ? Referrable.__lookup_by_key(__p.__vector(o), key, __p.bb) : null; } + public Referrable? VectorOfStrongReferrablesByKey(ulong key) { int o = __p.__offset(80); return o != 0 ? Referrable.__lookup_by_key(null, __p.__vector(o), key, __p.bb) : null; } + public Referrable? VectorOfStrongReferrablesByKey(Referrable? obj, ulong key) { int o = __p.__offset(80); return o != 0 ? Referrable.__lookup_by_key(obj, __p.__vector(o), key, __p.bb) : null; } public ulong CoOwningReference { get { int o = __p.__offset(82); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } } public bool MutateCoOwningReference(ulong co_owning_reference) { int o = __p.__offset(82); if (o != 0) { __p.bb.PutUlong(o + __p.bb_pos, co_owning_reference); return true; } else { return false; } } public ulong VectorOfCoOwningReferences(int j) { int o = __p.__offset(84); return o != 0 ? __p.bb.GetUlong(__p.__vector(o) + j * 8) : (ulong)0; } diff --git a/tests/MyGame/Example/Monster.java b/tests/MyGame/Example/Monster.java index 8bc35ca4..b5a1c930 100644 --- a/tests/MyGame/Example/Monster.java +++ b/tests/MyGame/Example/Monster.java @@ -131,7 +131,8 @@ public final class Monster extends Table { public Referrable vectorOfStrongReferrables(int j) { return vectorOfStrongReferrables(new Referrable(), j); } public Referrable vectorOfStrongReferrables(Referrable obj, int j) { int o = __offset(80); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; } public int vectorOfStrongReferrablesLength() { int o = __offset(80); return o != 0 ? __vector_len(o) : 0; } - public Referrable vectorOfStrongReferrablesByKey(long key) { int o = __offset(80); return o != 0 ? Referrable.__lookup_by_key(__vector(o), key, bb) : null; } + public Referrable vectorOfStrongReferrablesByKey(long key) { int o = __offset(80); return o != 0 ? Referrable.__lookup_by_key(null, __vector(o), key, bb) : null; } + public Referrable vectorOfStrongReferrablesByKey(Referrable obj, long key) { int o = __offset(80); return o != 0 ? Referrable.__lookup_by_key(obj, __vector(o), key, bb) : null; } public long coOwningReference() { int o = __offset(82); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } public boolean mutateCoOwningReference(long co_owning_reference) { int o = __offset(82); if (o != 0) { bb.putLong(o + bb_pos, co_owning_reference); return true; } else { return false; } } public long vectorOfCoOwningReferences(int j) { int o = __offset(84); return o != 0 ? bb.getLong(__vector(o) + j * 8) : 0; } diff --git a/tests/MyGame/Example/Referrable.cs b/tests/MyGame/Example/Referrable.cs new file mode 100644 index 00000000..1367f3aa --- /dev/null +++ b/tests/MyGame/Example/Referrable.cs @@ -0,0 +1,64 @@ +// <auto-generated> +// automatically generated by the FlatBuffers compiler, do not modify +// </auto-generated> + +namespace MyGame.Example +{ + +using global::System; +using global::FlatBuffers; + +public struct Referrable : IFlatbufferObject +{ + private Table __p; + public ByteBuffer ByteBuffer { get { return __p.bb; } } + public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); } + public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } + public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; } + public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public ulong Id { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } } + public bool MutateId(ulong id) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutUlong(o + __p.bb_pos, id); return true; } else { return false; } } + + public static Offset<Referrable> CreateReferrable(FlatBufferBuilder builder, + ulong id = 0) { + builder.StartObject(1); + Referrable.AddId(builder, id); + return Referrable.EndReferrable(builder); + } + + public static void StartReferrable(FlatBufferBuilder builder) { builder.StartObject(1); } + public static void AddId(FlatBufferBuilder builder, ulong id) { builder.AddUlong(0, id, 0); } + public static Offset<Referrable> EndReferrable(FlatBufferBuilder builder) { + int o = builder.EndObject(); + return new Offset<Referrable>(o); + } + + public static VectorOffset CreateSortedVectorOfReferrable(FlatBufferBuilder builder, Offset<Referrable>[] offsets) { + Array.Sort(offsets, (Offset<Referrable> o1, Offset<Referrable> o2) => builder.DataBuffer.GetUlong(Table.__offset(4, o1.Value, builder.DataBuffer)).CompareTo(builder.DataBuffer.GetUlong(Table.__offset(4, o2.Value, builder.DataBuffer)))); + return builder.CreateVectorOfTables(offsets); + } + + public static Referrable? __lookup_by_key(Referrable obj, int vectorLocation, ulong key, ByteBuffer bb) { + int span = bb.GetInt(vectorLocation - 4); + int start = 0; + while (span != 0) { + int middle = span / 2; + int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb); + int comp = bb.GetUlong(Table.__offset(4, bb.Length - tableOffset, bb)).CompareTo(key); + if (comp > 0) { + span = middle; + } else if (comp < 0) { + middle++; + start += middle; + span -= middle; + } else { + return (obj == null ? new Referrable(), obj).__assign(tableOffset, bb); + } + } + return null; + } +}; + + +} diff --git a/tests/MyGame/Example/Referrable.go b/tests/MyGame/Example/Referrable.go new file mode 100644 index 00000000..1fae1869 --- /dev/null +++ b/tests/MyGame/Example/Referrable.go @@ -0,0 +1,49 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +package Example + +import ( + flatbuffers "github.com/google/flatbuffers/go" +) + +type Referrable struct { + _tab flatbuffers.Table +} + +func GetRootAsReferrable(buf []byte, offset flatbuffers.UOffsetT) *Referrable { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &Referrable{} + x.Init(buf, n+offset) + return x +} + +func (rcv *Referrable) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *Referrable) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *Referrable) Id() uint64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.GetUint64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *Referrable) MutateId(n uint64) bool { + return rcv._tab.MutateUint64Slot(4, n) +} + +func ReferrableStart(builder *flatbuffers.Builder) { + builder.StartObject(1) +} +func ReferrableAddId(builder *flatbuffers.Builder, id uint64) { + builder.PrependUint64Slot(0, id, 0) +} +func ReferrableEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} diff --git a/tests/MyGame/Example/Referrable.java b/tests/MyGame/Example/Referrable.java new file mode 100644 index 00000000..5d66d2a5 --- /dev/null +++ b/tests/MyGame/Example/Referrable.java @@ -0,0 +1,62 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +package MyGame.Example; + +import java.nio.*; +import java.lang.*; +import java.util.*; +import com.google.flatbuffers.*; + +@SuppressWarnings("unused") +public final class Referrable extends Table { + public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); } + public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } + public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; } + public Referrable __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } + + public long id() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; } + public boolean mutateId(long id) { int o = __offset(4); if (o != 0) { bb.putLong(o + bb_pos, id); return true; } else { return false; } } + + public static int createReferrable(FlatBufferBuilder builder, + long id) { + builder.startObject(1); + Referrable.addId(builder, id); + return Referrable.endReferrable(builder); + } + + public static void startReferrable(FlatBufferBuilder builder) { builder.startObject(1); } + public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); } + public static int endReferrable(FlatBufferBuilder builder) { + int o = builder.endObject(); + return o; + } + + @Override + protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) { + long val_1 = _bb.getLong(__offset(4, o1, _bb)); + long val_2 = _bb.getLong(__offset(4, o2, _bb)); + return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0; + } + + public static Referrable __lookup_by_key(Referrable obj, int vectorLocation, long key, ByteBuffer bb) { + int span = bb.getInt(vectorLocation - 4); + int start = 0; + while (span != 0) { + int middle = span / 2; + int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb); + long val = bb.getLong(__offset(4, bb.capacity() - tableOffset, bb)); + int comp = val > key ? 1 : val < key ? -1 : 0; + if (comp > 0) { + span = middle; + } else if (comp < 0) { + middle++; + start += middle; + span -= middle; + } else { + return (obj == null ? new Referrable(), obj).__assign(tableOffset, bb); + } + } + return null; + } +} + diff --git a/tests/MyGame/Example/Referrable.php b/tests/MyGame/Example/Referrable.php new file mode 100644 index 00000000..58440110 --- /dev/null +++ b/tests/MyGame/Example/Referrable.php @@ -0,0 +1,99 @@ +<?php +// automatically generated by the FlatBuffers compiler, do not modify + +namespace MyGame\Example; + +use \Google\FlatBuffers\Struct; +use \Google\FlatBuffers\Table; +use \Google\FlatBuffers\ByteBuffer; +use \Google\FlatBuffers\FlatBufferBuilder; + +class Referrable extends Table +{ + /** + * @param ByteBuffer $bb + * @return Referrable + */ + public static function getRootAsReferrable(ByteBuffer $bb) + { + $obj = new Referrable(); + return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb)); + } + + public static function ReferrableIdentifier() + { + return "MONS"; + } + + public static function ReferrableBufferHasIdentifier(ByteBuffer $buf) + { + return self::__has_identifier($buf, self::ReferrableIdentifier()); + } + + public static function ReferrableExtension() + { + return "mon"; + } + + /** + * @param int $_i offset + * @param ByteBuffer $_bb + * @return Referrable + **/ + public function init($_i, ByteBuffer $_bb) + { + $this->bb_pos = $_i; + $this->bb = $_bb; + return $this; + } + + /** + * @return ulong + */ + public function getId() + { + $o = $this->__offset(4); + return $o != 0 ? $this->bb->getUlong($o + $this->bb_pos) : 0; + } + + /** + * @param FlatBufferBuilder $builder + * @return void + */ + public static function startReferrable(FlatBufferBuilder $builder) + { + $builder->StartObject(1); + } + + /** + * @param FlatBufferBuilder $builder + * @return Referrable + */ + public static function createReferrable(FlatBufferBuilder $builder, $id) + { + $builder->startObject(1); + self::addId($builder, $id); + $o = $builder->endObject(); + return $o; + } + + /** + * @param FlatBufferBuilder $builder + * @param ulong + * @return void + */ + public static function addId(FlatBufferBuilder $builder, $id) + { + $builder->addUlongX(0, $id, 0); + } + + /** + * @param FlatBufferBuilder $builder + * @return int table offset + */ + public static function endReferrable(FlatBufferBuilder $builder) + { + $o = $builder->endObject(); + return $o; + } +} diff --git a/tests/MyGame/Example/Referrable.py b/tests/MyGame/Example/Referrable.py new file mode 100644 index 00000000..897b4ac4 --- /dev/null +++ b/tests/MyGame/Example/Referrable.py @@ -0,0 +1,30 @@ +# automatically generated by the FlatBuffers compiler, do not modify + +# namespace: Example + +import flatbuffers + +class Referrable(object): + __slots__ = ['_tab'] + + @classmethod + def GetRootAsReferrable(cls, buf, offset): + n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) + x = Referrable() + x.Init(buf, n + offset) + return x + + # Referrable + def Init(self, buf, pos): + self._tab = flatbuffers.table.Table(buf, pos) + + # Referrable + def Id(self): + o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) + if o != 0: + return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) + return 0 + +def ReferrableStart(builder): builder.StartObject(1) +def ReferrableAddId(builder, id): builder.PrependUint64Slot(0, id, 0) +def ReferrableEnd(builder): return builder.EndObject() diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs Binary files differindex 76057281..422c36fe 100644 --- a/tests/monster_test.bfbs +++ b/tests/monster_test.bfbs diff --git a/tests/namespace_test/namespace_test2_generated.ts b/tests/namespace_test/namespace_test2_generated.ts index aa623a87..18f1d6e8 100644 --- a/tests/namespace_test/namespace_test2_generated.ts +++ b/tests/namespace_test/namespace_test2_generated.ts @@ -1,6 +1,6 @@ // automatically generated by the FlatBuffers compiler, do not modify -import * as NS4989953370203581498 from "./namespace_test1_generated"; +import * as NS9459827973991502386 from "./namespace_test1_generated"; /** * @constructor */ @@ -39,24 +39,24 @@ static getRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):T * @param {NamespaceA.NamespaceB.TableInNestedNS=} obj * @returns {NamespaceA.NamespaceB.TableInNestedNS|null} */ -fooTable(obj?:NS4989953370203581498.NamespaceA.NamespaceB.TableInNestedNS):NS4989953370203581498.NamespaceA.NamespaceB.TableInNestedNS|null { +fooTable(obj?:NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS|null { var offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? (obj || new NS4989953370203581498.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; + return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; }; /** * @returns {NamespaceA.NamespaceB.EnumInNestedNS} */ -fooEnum():NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS { +fooEnum():NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS { var offset = this.bb!.__offset(this.bb_pos, 6); - return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb!.readInt8(this.bb_pos + offset)) : NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS.A; + return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb!.readInt8(this.bb_pos + offset)) : NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A; }; /** * @param {NamespaceA.NamespaceB.EnumInNestedNS} value * @returns {boolean} */ -mutate_foo_enum(value:NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS):boolean { +mutate_foo_enum(value:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS):boolean { var offset = this.bb!.__offset(this.bb_pos, 6); if (offset === 0) { @@ -71,9 +71,9 @@ mutate_foo_enum(value:NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS * @param {NamespaceA.NamespaceB.StructInNestedNS=} obj * @returns {NamespaceA.NamespaceB.StructInNestedNS|null} */ -fooStruct(obj?:NS4989953370203581498.NamespaceA.NamespaceB.StructInNestedNS):NS4989953370203581498.NamespaceA.NamespaceB.StructInNestedNS|null { +fooStruct(obj?:NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS|null { var offset = this.bb!.__offset(this.bb_pos, 8); - return offset ? (obj || new NS4989953370203581498.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb!) : null; + return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb!) : null; }; /** @@ -95,8 +95,8 @@ static addFooTable(builder:flatbuffers.Builder, fooTableOffset:flatbuffers.Offse * @param {flatbuffers.Builder} builder * @param {NamespaceA.NamespaceB.EnumInNestedNS} fooEnum */ -static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS) { - builder.addFieldInt8(1, fooEnum, NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS.A); +static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS) { + builder.addFieldInt8(1, fooEnum, NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A); }; /** |