add flatbuffers
commit 6da1cf79d90eb242e7da5318241d42279a3df3ba Author: Max Burke <max@urbanlogiq.com> Date: Sun Jan 19 14:47:28 2020 -0800 [rust] Add use declarations to Rust-generated bindings for imported FB definitions (#5645) * Bugfix for Rust generation of union fields named with language keywords
This commit is contained in:
65
flatbuffers/tests/MyGame/Example/Referrable.cs
Normal file
65
flatbuffers/tests/MyGame/Example/Referrable.cs
Normal file
@ -0,0 +1,65 @@
|
||||
// <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 void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_1_11_1(); }
|
||||
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 = new Table(_i, _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<MyGame.Example.Referrable> CreateReferrable(FlatBufferBuilder builder,
|
||||
ulong id = 0) {
|
||||
builder.StartTable(1);
|
||||
Referrable.AddId(builder, id);
|
||||
return Referrable.EndReferrable(builder);
|
||||
}
|
||||
|
||||
public static void StartReferrable(FlatBufferBuilder builder) { builder.StartTable(1); }
|
||||
public static void AddId(FlatBufferBuilder builder, ulong id) { builder.AddUlong(0, id, 0); }
|
||||
public static Offset<MyGame.Example.Referrable> EndReferrable(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<MyGame.Example.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(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 new Referrable().__assign(tableOffset, bb);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user