...

Text file src/github.com/google/flatbuffers/tests/KeywordTest/Table2.cs

Documentation: github.com/google/flatbuffers/tests/KeywordTest

     1// <auto-generated>
     2//  automatically generated by the FlatBuffers compiler, do not modify
     3// </auto-generated>
     4
     5namespace KeywordTest
     6{
     7
     8using global::System;
     9using global::System.Collections.Generic;
    10using global::Google.FlatBuffers;
    11
    12public struct Table2 : IFlatbufferObject
    13{
    14  private Table __p;
    15  public ByteBuffer ByteBuffer { get { return __p.bb; } }
    16  public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_5_26(); }
    17  public static Table2 GetRootAsTable2(ByteBuffer _bb) { return GetRootAsTable2(_bb, new Table2()); }
    18  public static Table2 GetRootAsTable2(ByteBuffer _bb, Table2 obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
    19  public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
    20  public Table2 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
    21
    22  public KeywordTest.KeywordsInUnion TypeType { get { int o = __p.__offset(4); return o != 0 ? (KeywordTest.KeywordsInUnion)__p.bb.Get(o + __p.bb_pos) : KeywordTest.KeywordsInUnion.NONE; } }
    23  public TTable? Type<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(6); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
    24  public KeywordTest.KeywordsInTable TypeAsstatic() { return Type<KeywordTest.KeywordsInTable>().Value; }
    25  public KeywordTest.KeywordsInTable TypeAsinternal() { return Type<KeywordTest.KeywordsInTable>().Value; }
    26
    27  public static Offset<KeywordTest.Table2> CreateTable2(FlatBufferBuilder builder,
    28      KeywordTest.KeywordsInUnion type_type = KeywordTest.KeywordsInUnion.NONE,
    29      int typeOffset = 0) {
    30    builder.StartTable(2);
    31    Table2.AddType(builder, typeOffset);
    32    Table2.AddTypeType(builder, type_type);
    33    return Table2.EndTable2(builder);
    34  }
    35
    36  public static void StartTable2(FlatBufferBuilder builder) { builder.StartTable(2); }
    37  public static void AddTypeType(FlatBufferBuilder builder, KeywordTest.KeywordsInUnion typeType) { builder.AddByte(0, (byte)typeType, 0); }
    38  public static void AddType(FlatBufferBuilder builder, int typeOffset) { builder.AddOffset(1, typeOffset, 0); }
    39  public static Offset<KeywordTest.Table2> EndTable2(FlatBufferBuilder builder) {
    40    int o = builder.EndTable();
    41    return new Offset<KeywordTest.Table2>(o);
    42  }
    43  public Table2T UnPack() {
    44    var _o = new Table2T();
    45    this.UnPackTo(_o);
    46    return _o;
    47  }
    48  public void UnPackTo(Table2T _o) {
    49    _o.Type = new KeywordTest.KeywordsInUnionUnion();
    50    _o.Type.Type = this.TypeType;
    51    switch (this.TypeType) {
    52      default: break;
    53      case KeywordTest.KeywordsInUnion.static:
    54        _o.Type.Value = this.Type<KeywordTest.KeywordsInTable>().HasValue ? this.Type<KeywordTest.KeywordsInTable>().Value.UnPack() : null;
    55        break;
    56      case KeywordTest.KeywordsInUnion.internal:
    57        _o.Type.Value = this.Type<KeywordTest.KeywordsInTable>().HasValue ? this.Type<KeywordTest.KeywordsInTable>().Value.UnPack() : null;
    58        break;
    59    }
    60  }
    61  public static Offset<KeywordTest.Table2> Pack(FlatBufferBuilder builder, Table2T _o) {
    62    if (_o == null) return default(Offset<KeywordTest.Table2>);
    63    var _type_type = _o.Type == null ? KeywordTest.KeywordsInUnion.NONE : _o.Type.Type;
    64    var _type = _o.Type == null ? 0 : KeywordTest.KeywordsInUnionUnion.Pack(builder, _o.Type);
    65    return CreateTable2(
    66      builder,
    67      _type_type,
    68      _type);
    69  }
    70}
    71
    72public class Table2T
    73{
    74  [Newtonsoft.Json.JsonProperty("type_type")]
    75  private KeywordTest.KeywordsInUnion TypeType {
    76    get {
    77      return this.Type != null ? this.Type.Type : KeywordTest.KeywordsInUnion.NONE;
    78    }
    79    set {
    80      this.Type = new KeywordTest.KeywordsInUnionUnion();
    81      this.Type.Type = value;
    82    }
    83  }
    84  [Newtonsoft.Json.JsonProperty("type")]
    85  [Newtonsoft.Json.JsonConverter(typeof(KeywordTest.KeywordsInUnionUnion_JsonConverter))]
    86  public KeywordTest.KeywordsInUnionUnion Type { get; set; }
    87
    88  public Table2T() {
    89    this.Type = null;
    90  }
    91}
    92
    93
    94static public class Table2Verify
    95{
    96  static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
    97  {
    98    return verifier.VerifyTableStart(tablePos)
    99      && verifier.VerifyField(tablePos, 4 /*TypeType*/, 1 /*KeywordTest.KeywordsInUnion*/, 1, false)
   100      && verifier.VerifyUnion(tablePos, 4, 6 /*Type*/, KeywordTest.KeywordsInUnionVerify.Verify, false)
   101      && verifier.VerifyTableEnd(tablePos);
   102  }
   103}
   104
   105}

View as plain text