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