-
Notifications
You must be signed in to change notification settings - Fork 109
/
AssociatedFile.go
123 lines (106 loc) · 3.33 KB
/
AssociatedFile.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
// Code generated by the FlatBuffers compiler. DO NOT EDIT.
package tflite_metadata
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type AssociatedFileT struct {
Name string
Description string
Type AssociatedFileType
Locale string
}
func (t *AssociatedFileT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 }
nameOffset := builder.CreateString(t.Name)
descriptionOffset := builder.CreateString(t.Description)
localeOffset := builder.CreateString(t.Locale)
AssociatedFileStart(builder)
AssociatedFileAddName(builder, nameOffset)
AssociatedFileAddDescription(builder, descriptionOffset)
AssociatedFileAddType(builder, t.Type)
AssociatedFileAddLocale(builder, localeOffset)
return AssociatedFileEnd(builder)
}
func (rcv *AssociatedFile) UnPackTo(t *AssociatedFileT) {
t.Name = string(rcv.Name())
t.Description = string(rcv.Description())
t.Type = rcv.Type()
t.Locale = string(rcv.Locale())
}
func (rcv *AssociatedFile) UnPack() *AssociatedFileT {
if rcv == nil { return nil }
t := &AssociatedFileT{}
rcv.UnPackTo(t)
return t
}
type AssociatedFile struct {
_tab flatbuffers.Table
}
func GetRootAsAssociatedFile(buf []byte, offset flatbuffers.UOffsetT) *AssociatedFile {
n := flatbuffers.GetUOffsetT(buf[offset:])
x := &AssociatedFile{}
x.Init(buf, n+offset)
return x
}
func GetSizePrefixedRootAsAssociatedFile(buf []byte, offset flatbuffers.UOffsetT) *AssociatedFile {
n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:])
x := &AssociatedFile{}
x.Init(buf, n+offset+flatbuffers.SizeUint32)
return x
}
func (rcv *AssociatedFile) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *AssociatedFile) Table() flatbuffers.Table {
return rcv._tab
}
func (rcv *AssociatedFile) Name() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *AssociatedFile) Description() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func (rcv *AssociatedFile) Type() AssociatedFileType {
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
if o != 0 {
return AssociatedFileType(rcv._tab.GetInt8(o + rcv._tab.Pos))
}
return 0
}
func (rcv *AssociatedFile) MutateType(n AssociatedFileType) bool {
return rcv._tab.MutateInt8Slot(8, int8(n))
}
func (rcv *AssociatedFile) Locale() []byte {
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.ByteVector(o + rcv._tab.Pos)
}
return nil
}
func AssociatedFileStart(builder *flatbuffers.Builder) {
builder.StartObject(4)
}
func AssociatedFileAddName(builder *flatbuffers.Builder, name flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(name), 0)
}
func AssociatedFileAddDescription(builder *flatbuffers.Builder, description flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(description), 0)
}
func AssociatedFileAddType(builder *flatbuffers.Builder, type_ AssociatedFileType) {
builder.PrependInt8Slot(2, int8(type_), 0)
}
func AssociatedFileAddLocale(builder *flatbuffers.Builder, locale flatbuffers.UOffsetT) {
builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(locale), 0)
}
func AssociatedFileEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
return builder.EndObject()
}