MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / generateMap

Function generateMap

protocol/nbt/decoder.go:19–42  ·  view source on GitHub ↗
(v reflect.Value)

Source from the content-addressed store, hash-verified

17 }}
18
19func generateMap(v reflect.Value) map[string]reflect.Value {
20 m := valueMap.Get().(map[string]reflect.Value)
21 clear(m)
22 ty := v.Type()
23 for i := 0; i < v.NumField(); i++ {
24 ft := ty.Field(i)
25
26 if !ft.IsExported() {
27 continue
28 }
29
30 found := ft.Name
31 if n, ok := ft.Tag.Lookup("nbt"); ok {
32 found = n
33 }
34 if i := strings.Index(found, ",omitempty"); i != -1 {
35 found = found[:i]
36 }
37
38 m[found] = v.Field(i)
39 }
40
41 return m
42}
43
44const (
45 End = iota

Callers 5

DecodeRootCompoundMethod · 0.85
DecodeMethod · 0.85
decodeCompoundMapMethod · 0.85
decodeCompoundStructMethod · 0.85
decodeListMethod · 0.85

Calls 3

LookupMethod · 0.80
GetMethod · 0.45
TypeMethod · 0.45

Tested by

no test coverage detected