mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-16 09:12:22 +00:00
Support binary search for struct in cpp (#4245)
* Support binary search for struct in cpp CreateVectorOfSortedStruct is provided for convenience. * fix continuous-integration error * add generated files * compile Ability.cs in csharp test * compile Ability.cs in csharp * modify according to code review
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
89041a1686
commit
a5cc2092a6
30
tests/MyGame/Example/Ability.cs
Normal file
30
tests/MyGame/Example/Ability.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using System;
|
||||
using FlatBuffers;
|
||||
|
||||
public struct Ability : IFlatbufferObject
|
||||
{
|
||||
private Struct __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
|
||||
public Ability __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public uint Id { get { return __p.bb.GetUint(__p.bb_pos + 0); } }
|
||||
public void MutateId(uint id) { __p.bb.PutUint(__p.bb_pos + 0, id); }
|
||||
public uint Distance { get { return __p.bb.GetUint(__p.bb_pos + 4); } }
|
||||
public void MutateDistance(uint distance) { __p.bb.PutUint(__p.bb_pos + 4, distance); }
|
||||
|
||||
public static Offset<Ability> CreateAbility(FlatBufferBuilder builder, uint Id, uint Distance) {
|
||||
builder.Prep(4, 8);
|
||||
builder.PutUint(Distance);
|
||||
builder.PutUint(Id);
|
||||
return new Offset<Ability>(builder.Offset);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user