blob: 14b66b5b5ece38c2a327ee8b2015c2de78e6e316 [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// Code generated by the FlatBuffers compiler. DO NOT EDIT.
2
3package Example
4
Austin Schuh272c6132020-11-14 16:37:52 -08005import (
6 "strconv"
7
8 flatbuffers "github.com/google/flatbuffers/go"
9
10 MyGame__Example2 "MyGame/Example2"
11)
Austin Schuhe89fa2d2019-08-14 20:24:23 -070012
13type Any byte
14
15const (
16 AnyNONE Any = 0
17 AnyMonster Any = 1
18 AnyTestSimpleTableWithEnum Any = 2
19 AnyMyGame_Example2_Monster Any = 3
20)
21
22var EnumNamesAny = map[Any]string{
23 AnyNONE: "NONE",
24 AnyMonster: "Monster",
25 AnyTestSimpleTableWithEnum: "TestSimpleTableWithEnum",
26 AnyMyGame_Example2_Monster: "MyGame_Example2_Monster",
27}
28
29var EnumValuesAny = map[string]Any{
30 "NONE": AnyNONE,
31 "Monster": AnyMonster,
32 "TestSimpleTableWithEnum": AnyTestSimpleTableWithEnum,
33 "MyGame_Example2_Monster": AnyMyGame_Example2_Monster,
34}
35
36func (v Any) String() string {
37 if s, ok := EnumNamesAny[v]; ok {
38 return s
39 }
40 return "Any(" + strconv.FormatInt(int64(v), 10) + ")"
41}
Austin Schuh272c6132020-11-14 16:37:52 -080042
43type AnyT struct {
44 Type Any
45 Value interface{}
46}
47
48func (t *AnyT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
49 if t == nil {
50 return 0
51 }
52 switch t.Type {
53 case AnyMonster:
54 return t.Value.(*MonsterT).Pack(builder)
55 case AnyTestSimpleTableWithEnum:
56 return t.Value.(*TestSimpleTableWithEnumT).Pack(builder)
57 case AnyMyGame_Example2_Monster:
58 return t.Value.(*MyGame__Example2.MonsterT).Pack(builder)
59 }
60 return 0
61}
62
63func (rcv Any) UnPack(table flatbuffers.Table) *AnyT {
64 switch rcv {
65 case AnyMonster:
66 x := Monster{_tab: table}
67 return &AnyT{ Type: AnyMonster, Value: x.UnPack() }
68 case AnyTestSimpleTableWithEnum:
69 x := TestSimpleTableWithEnum{_tab: table}
70 return &AnyT{ Type: AnyTestSimpleTableWithEnum, Value: x.UnPack() }
71 case AnyMyGame_Example2_Monster:
72 x := Monster{_tab: table}
73 return &AnyT{ Type: AnyMyGame_Example2_Monster, Value: x.UnPack() }
74 }
75 return nil
76}