blob: b8cde12b861556e019f34e2adef6a024b867d7dc [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// Code generated by the FlatBuffers compiler. DO NOT EDIT.
2
3package Example
4
5import (
6 flatbuffers "github.com/google/flatbuffers/go"
7)
8
Austin Schuh272c6132020-11-14 16:37:52 -08009type TestSimpleTableWithEnumT struct {
10 Color Color
11}
12
13func (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
20func (rcv *TestSimpleTableWithEnum) UnPackTo(t *TestSimpleTableWithEnumT) {
21 t.Color = rcv.Color()
22}
23
24func (rcv *TestSimpleTableWithEnum) UnPack() *TestSimpleTableWithEnumT {
25 if rcv == nil { return nil }
26 t := &TestSimpleTableWithEnumT{}
27 rcv.UnPackTo(t)
28 return t
29}
30
Austin Schuhe89fa2d2019-08-14 20:24:23 -070031type TestSimpleTableWithEnum struct {
32 _tab flatbuffers.Table
33}
34
35func 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 Schuh272c6132020-11-14 16:37:52 -080042func 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 Schuhe89fa2d2019-08-14 20:24:23 -070049func (rcv *TestSimpleTableWithEnum) Init(buf []byte, i flatbuffers.UOffsetT) {
50 rcv._tab.Bytes = buf
51 rcv._tab.Pos = i
52}
53
54func (rcv *TestSimpleTableWithEnum) Table() flatbuffers.Table {
55 return rcv._tab
56}
57
58func (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
66func (rcv *TestSimpleTableWithEnum) MutateColor(n Color) bool {
67 return rcv._tab.MutateByteSlot(4, byte(n))
68}
69
70func TestSimpleTableWithEnumStart(builder *flatbuffers.Builder) {
71 builder.StartObject(1)
72}
73func TestSimpleTableWithEnumAddColor(builder *flatbuffers.Builder, color Color) {
74 builder.PrependByteSlot(0, byte(color), 2)
75}
76func TestSimpleTableWithEnumEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
77 return builder.EndObject()
78}