...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/NestedStruct.cs

Documentation: github.com/google/flatbuffers/tests/MyGame/Example

     1// <auto-generated>
     2//  automatically generated by the FlatBuffers compiler, do not modify
     3// </auto-generated>
     4
     5namespace MyGame.Example
     6{
     7
     8using global::System;
     9using global::System.Collections.Generic;
    10using global::Google.FlatBuffers;
    11
    12public struct NestedStruct : IFlatbufferObject
    13{
    14  private Struct __p;
    15  public ByteBuffer ByteBuffer { get { return __p.bb; } }
    16  public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
    17  public NestedStruct __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    18
    19  public int A(int j) { return __p.bb.GetInt(__p.bb_pos + 0 + j * 4); }
    20  public void MutateA(int j, int a) { __p.bb.PutInt(__p.bb_pos + 0 + j * 4, a); }
    21  public MyGame.Example.TestEnum B { get { return (MyGame.Example.TestEnum)__p.bb.GetSbyte(__p.bb_pos + 8); } }
    22  public void MutateB(MyGame.Example.TestEnum b) { __p.bb.PutSbyte(__p.bb_pos + 8, (sbyte)b); }
    23  public MyGame.Example.TestEnum C(int j) { return (MyGame.Example.TestEnum)__p.bb.GetSbyte(__p.bb_pos + 9 + j * 1); }
    24  public void MutateC(int j, MyGame.Example.TestEnum c) { __p.bb.PutSbyte(__p.bb_pos + 9 + j * 1, (sbyte)c); }
    25  public long D(int j) { return __p.bb.GetLong(__p.bb_pos + 16 + j * 8); }
    26  public void MutateD(int j, long d) { __p.bb.PutLong(__p.bb_pos + 16 + j * 8, d); }
    27
    28  public static Offset<MyGame.Example.NestedStruct> CreateNestedStruct(FlatBufferBuilder builder, int[] A, MyGame.Example.TestEnum B, MyGame.Example.TestEnum[] C, long[] D) {
    29    builder.Prep(8, 32);
    30    for (int _idx0 = 2; _idx0 > 0; _idx0--) {
    31      builder.PutLong(D[_idx0-1]);
    32    }
    33    builder.Pad(5);
    34    for (int _idx0 = 2; _idx0 > 0; _idx0--) {
    35      builder.PutSbyte((sbyte)C[_idx0-1]);
    36    }
    37    builder.PutSbyte((sbyte)B);
    38    for (int _idx0 = 2; _idx0 > 0; _idx0--) {
    39      builder.PutInt(A[_idx0-1]);
    40    }
    41    return new Offset<MyGame.Example.NestedStruct>(builder.Offset);
    42  }
    43  public NestedStructT UnPack() {
    44    var _o = new NestedStructT();
    45    this.UnPackTo(_o);
    46    return _o;
    47  }
    48  public void UnPackTo(NestedStructT _o) {
    49    _o.A = new int[2];
    50    for (var _j = 0; _j < 2; ++_j) { _o.A[_j] = this.A(_j); }
    51    _o.B = this.B;
    52    _o.C = new MyGame.Example.TestEnum[2];
    53    for (var _j = 0; _j < 2; ++_j) { _o.C[_j] = this.C(_j); }
    54    _o.D = new long[2];
    55    for (var _j = 0; _j < 2; ++_j) { _o.D[_j] = this.D(_j); }
    56  }
    57  public static Offset<MyGame.Example.NestedStruct> Pack(FlatBufferBuilder builder, NestedStructT _o) {
    58    if (_o == null) return default(Offset<MyGame.Example.NestedStruct>);
    59    var _a = _o.A;
    60    var _c = _o.C;
    61    var _d = _o.D;
    62    return CreateNestedStruct(
    63      builder,
    64      _a,
    65      _o.B,
    66      _c,
    67      _d);
    68  }
    69}
    70
    71public class NestedStructT
    72{
    73  [Newtonsoft.Json.JsonProperty("a")]
    74  public int[] A { get; set; }
    75  [Newtonsoft.Json.JsonProperty("b")]
    76  public MyGame.Example.TestEnum B { get; set; }
    77  [Newtonsoft.Json.JsonProperty("c")]
    78  public MyGame.Example.TestEnum[] C { get; set; }
    79  [Newtonsoft.Json.JsonProperty("d")]
    80  public long[] D { get; set; }
    81
    82  public NestedStructT() {
    83    this.A = new int[2];
    84    this.B = MyGame.Example.TestEnum.A;
    85    this.C = new MyGame.Example.TestEnum[2];
    86    this.D = new long[2];
    87  }
    88}
    89
    90
    91}

View as plain text