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