xref: /aosp_15_r20/external/flatbuffers/tests/MyGame/Example/TestSimpleTableWithEnum.cs (revision 890232f25432b36107d06881e0a25aaa6b473652)
1*890232f2SAndroid Build Coastguard Worker // <auto-generated>
2*890232f2SAndroid Build Coastguard Worker //  automatically generated by the FlatBuffers compiler, do not modify
3*890232f2SAndroid Build Coastguard Worker // </auto-generated>
4*890232f2SAndroid Build Coastguard Worker 
5*890232f2SAndroid Build Coastguard Worker namespace MyGame.Example
6*890232f2SAndroid Build Coastguard Worker {
7*890232f2SAndroid Build Coastguard Worker 
8*890232f2SAndroid Build Coastguard Worker using global::System;
9*890232f2SAndroid Build Coastguard Worker using global::System.Collections.Generic;
10*890232f2SAndroid Build Coastguard Worker using global::FlatBuffers;
11*890232f2SAndroid Build Coastguard Worker 
12*890232f2SAndroid Build Coastguard Worker internal partial struct TestSimpleTableWithEnum : IFlatbufferObject
13*890232f2SAndroid Build Coastguard Worker {
14*890232f2SAndroid Build Coastguard Worker   private Table __p;
15*890232f2SAndroid Build Coastguard Worker   public ByteBuffer ByteBuffer { get { return __p.bb; } }
ValidateVersionMyGame.Example.TestSimpleTableWithEnum16*890232f2SAndroid Build Coastguard Worker   public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
GetRootAsTestSimpleTableWithEnumMyGame.Example.TestSimpleTableWithEnum17*890232f2SAndroid Build Coastguard Worker   public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return GetRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
GetRootAsTestSimpleTableWithEnumMyGame.Example.TestSimpleTableWithEnum18*890232f2SAndroid Build Coastguard Worker   public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
__initMyGame.Example.TestSimpleTableWithEnum19*890232f2SAndroid Build Coastguard Worker   public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
__assignMyGame.Example.TestSimpleTableWithEnum20*890232f2SAndroid Build Coastguard Worker   public TestSimpleTableWithEnum __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
21*890232f2SAndroid Build Coastguard Worker 
22*890232f2SAndroid Build Coastguard Worker   public MyGame.Example.Color Color { get { int o = __p.__offset(4); return o != 0 ? (MyGame.Example.Color)__p.bb.Get(o + __p.bb_pos) : MyGame.Example.Color.Green; } }
MutateColorMyGame.Example.TestSimpleTableWithEnum23*890232f2SAndroid Build Coastguard Worker   public bool MutateColor(MyGame.Example.Color color) { int o = __p.__offset(4); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)color); return true; } else { return false; } }
24*890232f2SAndroid Build Coastguard Worker 
CreateTestSimpleTableWithEnumMyGame.Example.TestSimpleTableWithEnum25*890232f2SAndroid Build Coastguard Worker   public static Offset<MyGame.Example.TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(FlatBufferBuilder builder,
26*890232f2SAndroid Build Coastguard Worker       MyGame.Example.Color color = MyGame.Example.Color.Green) {
27*890232f2SAndroid Build Coastguard Worker     builder.StartTable(1);
28*890232f2SAndroid Build Coastguard Worker     TestSimpleTableWithEnum.AddColor(builder, color);
29*890232f2SAndroid Build Coastguard Worker     return TestSimpleTableWithEnum.EndTestSimpleTableWithEnum(builder);
30*890232f2SAndroid Build Coastguard Worker   }
31*890232f2SAndroid Build Coastguard Worker 
StartTestSimpleTableWithEnumMyGame.Example.TestSimpleTableWithEnum32*890232f2SAndroid Build Coastguard Worker   public static void StartTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.StartTable(1); }
AddColorMyGame.Example.TestSimpleTableWithEnum33*890232f2SAndroid Build Coastguard Worker   public static void AddColor(FlatBufferBuilder builder, MyGame.Example.Color color) { builder.AddByte(0, (byte)color, 2); }
EndTestSimpleTableWithEnumMyGame.Example.TestSimpleTableWithEnum34*890232f2SAndroid Build Coastguard Worker   public static Offset<MyGame.Example.TestSimpleTableWithEnum> EndTestSimpleTableWithEnum(FlatBufferBuilder builder) {
35*890232f2SAndroid Build Coastguard Worker     int o = builder.EndTable();
36*890232f2SAndroid Build Coastguard Worker     return new Offset<MyGame.Example.TestSimpleTableWithEnum>(o);
37*890232f2SAndroid Build Coastguard Worker   }
UnPackMyGame.Example.TestSimpleTableWithEnum38*890232f2SAndroid Build Coastguard Worker   public TestSimpleTableWithEnumT UnPack() {
39*890232f2SAndroid Build Coastguard Worker     var _o = new TestSimpleTableWithEnumT();
40*890232f2SAndroid Build Coastguard Worker     this.UnPackTo(_o);
41*890232f2SAndroid Build Coastguard Worker     return _o;
42*890232f2SAndroid Build Coastguard Worker   }
UnPackToMyGame.Example.TestSimpleTableWithEnum43*890232f2SAndroid Build Coastguard Worker   public void UnPackTo(TestSimpleTableWithEnumT _o) {
44*890232f2SAndroid Build Coastguard Worker     _o.Color = this.Color;
45*890232f2SAndroid Build Coastguard Worker   }
PackMyGame.Example.TestSimpleTableWithEnum46*890232f2SAndroid Build Coastguard Worker   public static Offset<MyGame.Example.TestSimpleTableWithEnum> Pack(FlatBufferBuilder builder, TestSimpleTableWithEnumT _o) {
47*890232f2SAndroid Build Coastguard Worker     if (_o == null) return default(Offset<MyGame.Example.TestSimpleTableWithEnum>);
48*890232f2SAndroid Build Coastguard Worker     return CreateTestSimpleTableWithEnum(
49*890232f2SAndroid Build Coastguard Worker       builder,
50*890232f2SAndroid Build Coastguard Worker       _o.Color);
51*890232f2SAndroid Build Coastguard Worker   }
52*890232f2SAndroid Build Coastguard Worker }
53*890232f2SAndroid Build Coastguard Worker 
54*890232f2SAndroid Build Coastguard Worker internal partial class TestSimpleTableWithEnumT
55*890232f2SAndroid Build Coastguard Worker {
56*890232f2SAndroid Build Coastguard Worker   [Newtonsoft.Json.JsonProperty("color")]
57*890232f2SAndroid Build Coastguard Worker   public MyGame.Example.Color Color { get; set; }
58*890232f2SAndroid Build Coastguard Worker 
TestSimpleTableWithEnumT()59*890232f2SAndroid Build Coastguard Worker   public TestSimpleTableWithEnumT() {
60*890232f2SAndroid Build Coastguard Worker     this.Color = MyGame.Example.Color.Green;
61*890232f2SAndroid Build Coastguard Worker   }
62*890232f2SAndroid Build Coastguard Worker }
63*890232f2SAndroid Build Coastguard Worker 
64*890232f2SAndroid Build Coastguard Worker 
65*890232f2SAndroid Build Coastguard Worker }
66