1*890232f2SAndroid Build Coastguard Worker// Code generated by the FlatBuffers compiler. DO NOT EDIT. 2*890232f2SAndroid Build Coastguard Worker 3*890232f2SAndroid Build Coastguard Workerpackage Example 4*890232f2SAndroid Build Coastguard Worker 5*890232f2SAndroid Build Coastguard Workerimport ( 6*890232f2SAndroid Build Coastguard Worker flatbuffers "github.com/google/flatbuffers/go" 7*890232f2SAndroid Build Coastguard Worker) 8*890232f2SAndroid Build Coastguard Worker 9*890232f2SAndroid Build Coastguard Workertype TestSimpleTableWithEnumT struct { 10*890232f2SAndroid Build Coastguard Worker Color Color `json:"color"` 11*890232f2SAndroid Build Coastguard Worker} 12*890232f2SAndroid Build Coastguard Worker 13*890232f2SAndroid Build Coastguard Workerfunc (t *TestSimpleTableWithEnumT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT { 14*890232f2SAndroid Build Coastguard Worker if t == nil { return 0 } 15*890232f2SAndroid Build Coastguard Worker TestSimpleTableWithEnumStart(builder) 16*890232f2SAndroid Build Coastguard Worker TestSimpleTableWithEnumAddColor(builder, t.Color) 17*890232f2SAndroid Build Coastguard Worker return TestSimpleTableWithEnumEnd(builder) 18*890232f2SAndroid Build Coastguard Worker} 19*890232f2SAndroid Build Coastguard Worker 20*890232f2SAndroid Build Coastguard Workerfunc (rcv *TestSimpleTableWithEnum) UnPackTo(t *TestSimpleTableWithEnumT) { 21*890232f2SAndroid Build Coastguard Worker t.Color = rcv.Color() 22*890232f2SAndroid Build Coastguard Worker} 23*890232f2SAndroid Build Coastguard Worker 24*890232f2SAndroid Build Coastguard Workerfunc (rcv *TestSimpleTableWithEnum) UnPack() *TestSimpleTableWithEnumT { 25*890232f2SAndroid Build Coastguard Worker if rcv == nil { return nil } 26*890232f2SAndroid Build Coastguard Worker t := &TestSimpleTableWithEnumT{} 27*890232f2SAndroid Build Coastguard Worker rcv.UnPackTo(t) 28*890232f2SAndroid Build Coastguard Worker return t 29*890232f2SAndroid Build Coastguard Worker} 30*890232f2SAndroid Build Coastguard Worker 31*890232f2SAndroid Build Coastguard Workertype TestSimpleTableWithEnum struct { 32*890232f2SAndroid Build Coastguard Worker _tab flatbuffers.Table 33*890232f2SAndroid Build Coastguard Worker} 34*890232f2SAndroid Build Coastguard Worker 35*890232f2SAndroid Build Coastguard Workerfunc GetRootAsTestSimpleTableWithEnum(buf []byte, offset flatbuffers.UOffsetT) *TestSimpleTableWithEnum { 36*890232f2SAndroid Build Coastguard Worker n := flatbuffers.GetUOffsetT(buf[offset:]) 37*890232f2SAndroid Build Coastguard Worker x := &TestSimpleTableWithEnum{} 38*890232f2SAndroid Build Coastguard Worker x.Init(buf, n+offset) 39*890232f2SAndroid Build Coastguard Worker return x 40*890232f2SAndroid Build Coastguard Worker} 41*890232f2SAndroid Build Coastguard Worker 42*890232f2SAndroid Build Coastguard Workerfunc GetSizePrefixedRootAsTestSimpleTableWithEnum(buf []byte, offset flatbuffers.UOffsetT) *TestSimpleTableWithEnum { 43*890232f2SAndroid Build Coastguard Worker n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:]) 44*890232f2SAndroid Build Coastguard Worker x := &TestSimpleTableWithEnum{} 45*890232f2SAndroid Build Coastguard Worker x.Init(buf, n+offset+flatbuffers.SizeUint32) 46*890232f2SAndroid Build Coastguard Worker return x 47*890232f2SAndroid Build Coastguard Worker} 48*890232f2SAndroid Build Coastguard Worker 49*890232f2SAndroid Build Coastguard Workerfunc (rcv *TestSimpleTableWithEnum) Init(buf []byte, i flatbuffers.UOffsetT) { 50*890232f2SAndroid Build Coastguard Worker rcv._tab.Bytes = buf 51*890232f2SAndroid Build Coastguard Worker rcv._tab.Pos = i 52*890232f2SAndroid Build Coastguard Worker} 53*890232f2SAndroid Build Coastguard Worker 54*890232f2SAndroid Build Coastguard Workerfunc (rcv *TestSimpleTableWithEnum) Table() flatbuffers.Table { 55*890232f2SAndroid Build Coastguard Worker return rcv._tab 56*890232f2SAndroid Build Coastguard Worker} 57*890232f2SAndroid Build Coastguard Worker 58*890232f2SAndroid Build Coastguard Workerfunc (rcv *TestSimpleTableWithEnum) Color() Color { 59*890232f2SAndroid Build Coastguard Worker o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) 60*890232f2SAndroid Build Coastguard Worker if o != 0 { 61*890232f2SAndroid Build Coastguard Worker return Color(rcv._tab.GetByte(o + rcv._tab.Pos)) 62*890232f2SAndroid Build Coastguard Worker } 63*890232f2SAndroid Build Coastguard Worker return 2 64*890232f2SAndroid Build Coastguard Worker} 65*890232f2SAndroid Build Coastguard Worker 66*890232f2SAndroid Build Coastguard Workerfunc (rcv *TestSimpleTableWithEnum) MutateColor(n Color) bool { 67*890232f2SAndroid Build Coastguard Worker return rcv._tab.MutateByteSlot(4, byte(n)) 68*890232f2SAndroid Build Coastguard Worker} 69*890232f2SAndroid Build Coastguard Worker 70*890232f2SAndroid Build Coastguard Workerfunc TestSimpleTableWithEnumStart(builder *flatbuffers.Builder) { 71*890232f2SAndroid Build Coastguard Worker builder.StartObject(1) 72*890232f2SAndroid Build Coastguard Worker} 73*890232f2SAndroid Build Coastguard Workerfunc TestSimpleTableWithEnumAddColor(builder *flatbuffers.Builder, color Color) { 74*890232f2SAndroid Build Coastguard Worker builder.PrependByteSlot(0, byte(color), 2) 75*890232f2SAndroid Build Coastguard Worker} 76*890232f2SAndroid Build Coastguard Workerfunc TestSimpleTableWithEnumEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { 77*890232f2SAndroid Build Coastguard Worker return builder.EndObject() 78*890232f2SAndroid Build Coastguard Worker} 79