forked from google/flatbuffers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TableInFirstNS.go
158 lines (137 loc) · 4.71 KB
/
TableInFirstNS.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package NamespaceA
import (
flatbuffers "github.com/google/flatbuffers/go"
NamespaceA__NamespaceB "NamespaceA/NamespaceB"
)
type TableInFirstNST struct {
FooTable *NamespaceA__NamespaceB.TableInNestedNST
FooEnum NamespaceA__NamespaceB.EnumInNestedNS
FooUnion *NamespaceA__NamespaceB.UnionInNestedNST
FooStruct *NamespaceA__NamespaceB.StructInNestedNST
}
func (t *TableInFirstNST) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
fooTableOffset := t.FooTable.Pack(builder)
fooUnionOffset := t.FooUnion.Pack(builder)
TableInFirstNSStart(builder)
TableInFirstNSAddFooTable(builder, fooTableOffset)
TableInFirstNSAddFooEnum(builder, t.FooEnum)
if t.FooUnion != nil {
TableInFirstNSAddFooUnionType(builder, t.FooUnion.Type)
}
TableInFirstNSAddFooUnion(builder, fooUnionOffset)
fooStructOffset := t.FooStruct.Pack(builder)
TableInFirstNSAddFooStruct(builder, fooStructOffset)
return TableInFirstNSEnd(builder)
}
func (rcv *TableInFirstNS) UnPackTo(t *TableInFirstNST) {
t.FooTable = rcv.FooTable(nil).UnPack()
t.FooEnum = rcv.FooEnum()
fooUnionTable := flatbuffers.Table{}
if rcv.FooUnion(&fooUnionTable) {
t.FooUnion = rcv.FooUnionType().UnPack(fooUnionTable)
}
t.FooStruct = rcv.FooStruct(nil).UnPack()
}
func (rcv *TableInFirstNS) UnPack() *TableInFirstNST {
if rcv == nil { return nil }
t := &TableInFirstNST{}
rcv.UnPackTo(t)
return t
}
type TableInFirstNS struct {
_tab flatbuffers.Table
}
func GetRootAsTableInFirstNS(buf []byte, offset flatbuffers.UOffsetT) *TableInFirstNS {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &TableInFirstNS{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsTableInFirstNS(buf []byte, offset flatbuffers.UOffsetT) *TableInFirstNS {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &TableInFirstNS{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *TableInFirstNS) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *TableInFirstNS) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *TableInFirstNS) FooTable(obj *NamespaceA__NamespaceB.TableInNestedNS) *NamespaceA__NamespaceB.TableInNestedNS {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
x := rcv._tab.Indirect(o + rcv._tab.Pos)
if obj == nil {
obj = new(NamespaceA__NamespaceB.TableInNestedNS)
}
obj.Init(rcv._tab.Bytes, x)
return obj
}
return nil
}
func (rcv *TableInFirstNS) FooEnum() NamespaceA__NamespaceB.EnumInNestedNS {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return NamespaceA__NamespaceB.EnumInNestedNS(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 0
}
func (rcv *TableInFirstNS) MutateFooEnum(n NamespaceA__NamespaceB.EnumInNestedNS) bool {
return rcv._tab.MutateInt8Slot(6, int8(n))
}
func (rcv *TableInFirstNS) FooUnionType() NamespaceA__NamespaceB.UnionInNestedNS {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return NamespaceA__NamespaceB.UnionInNestedNS(rcv._tab.GetByte(o + rcv._tab.Pos))
}
return 0
}
func (rcv *TableInFirstNS) MutateFooUnionType(n NamespaceA__NamespaceB.UnionInNestedNS) bool {
return rcv._tab.MutateByteSlot(8, byte(n))
}
func (rcv *TableInFirstNS) FooUnion(obj *flatbuffers.Table) bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
rcv._tab.Union(obj, o)
return true
}
return false
}
func (rcv *TableInFirstNS) FooStruct(obj *NamespaceA__NamespaceB.StructInNestedNS) *NamespaceA__NamespaceB.StructInNestedNS {
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
x := o + rcv._tab.Pos
if obj == nil {
obj = new(NamespaceA__NamespaceB.StructInNestedNS)
}
obj.Init(rcv._tab.Bytes, x)
return obj
}
return nil
}
func TableInFirstNSStart(builder *flatbuffers.Builder) {
builder.StartObject(5)
}
func TableInFirstNSAddFooTable(builder *flatbuffers.Builder, fooTable flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(fooTable), 0)
}
func TableInFirstNSAddFooEnum(builder *flatbuffers.Builder, fooEnum NamespaceA__NamespaceB.EnumInNestedNS) {
builder.PrependInt8Slot(1, int8(fooEnum), 0)
}
func TableInFirstNSAddFooUnionType(builder *flatbuffers.Builder, fooUnionType NamespaceA__NamespaceB.UnionInNestedNS) {
builder.PrependByteSlot(2, byte(fooUnionType), 0)
}
func TableInFirstNSAddFooUnion(builder *flatbuffers.Builder, fooUnion flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(fooUnion), 0)
}
func TableInFirstNSAddFooStruct(builder *flatbuffers.Builder, fooStruct flatbuffers.UOffsetT) {
builder.PrependStructSlot(4, flatbuffers.UOffsetT(fooStruct), 0)
}
func TableInFirstNSEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}