mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-20 13:25:06 +00:00
Switched C# accessors from classes to structs
This commit is contained in:
@@ -6,13 +6,16 @@ namespace NamespaceA.NamespaceB
|
||||
using System;
|
||||
using FlatBuffers;
|
||||
|
||||
public sealed class StructInNestedNS : Struct {
|
||||
public StructInNestedNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
|
||||
public struct StructInNestedNS : IFlatbufferObject
|
||||
{
|
||||
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 void MutateA(int a) { bb.PutInt(bb_pos + 0, a); }
|
||||
public int B { get { return bb.GetInt(bb_pos + 4); } }
|
||||
public void MutateB(int b) { bb.PutInt(bb_pos + 4, b); }
|
||||
public int A { get { return __p.bb.GetInt(__p.bb_pos + 0); } }
|
||||
public void MutateA(int a) { __p.bb.PutInt(__p.bb_pos + 0, a); }
|
||||
public int B { get { return __p.bb.GetInt(__p.bb_pos + 4); } }
|
||||
public void MutateB(int b) { __p.bb.PutInt(__p.bb_pos + 4, b); }
|
||||
|
||||
public static Offset<StructInNestedNS> CreateStructInNestedNS(FlatBufferBuilder builder, int A, int B) {
|
||||
builder.Prep(4, 8);
|
||||
|
||||
@@ -9,7 +9,8 @@ import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
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 void mutateA(int a) { bb.putInt(bb_pos + 0, a); }
|
||||
|
||||
@@ -6,13 +6,16 @@ namespace NamespaceA.NamespaceB
|
||||
using System;
|
||||
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, TableInNestedNS obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public TableInNestedNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
|
||||
public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS 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 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 bool MutateFoo(int foo) { int o = __offset(4); if (o != 0) { bb.PutInt(o + bb_pos, foo); return true; } else { return false; } }
|
||||
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 = __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,
|
||||
int foo = 0) {
|
||||
|
||||
@@ -10,8 +10,9 @@ import com.google.flatbuffers.*;
|
||||
@SuppressWarnings("unused")
|
||||
public final class TableInNestedNS extends Table {
|
||||
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 TableInNestedNS __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
|
||||
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS 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 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 boolean mutateFoo(int foo) { int o = __offset(4); if (o != 0) { bb.putInt(o + bb_pos, foo); return true; } else { return false; } }
|
||||
|
||||
Reference in New Issue
Block a user