xref: /aosp_15_r20/external/flatbuffers/tests/MyGame/Example/Any.py (revision 890232f25432b36107d06881e0a25aaa6b473652)
1*890232f2SAndroid Build Coastguard Worker# automatically generated by the FlatBuffers compiler, do not modify
2*890232f2SAndroid Build Coastguard Worker
3*890232f2SAndroid Build Coastguard Worker# namespace: Example
4*890232f2SAndroid Build Coastguard Worker
5*890232f2SAndroid Build Coastguard Workerclass Any(object):
6*890232f2SAndroid Build Coastguard Worker    NONE = 0
7*890232f2SAndroid Build Coastguard Worker    Monster = 1
8*890232f2SAndroid Build Coastguard Worker    TestSimpleTableWithEnum = 2
9*890232f2SAndroid Build Coastguard Worker    MyGame_Example2_Monster = 3
10*890232f2SAndroid Build Coastguard Worker
11*890232f2SAndroid Build Coastguard Workerdef AnyCreator(unionType, table):
12*890232f2SAndroid Build Coastguard Worker    from flatbuffers.table import Table
13*890232f2SAndroid Build Coastguard Worker    if not isinstance(table, Table):
14*890232f2SAndroid Build Coastguard Worker        return None
15*890232f2SAndroid Build Coastguard Worker    if unionType == Any().Monster:
16*890232f2SAndroid Build Coastguard Worker        import MyGame.Example.Monster
17*890232f2SAndroid Build Coastguard Worker        return MyGame.Example.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
18*890232f2SAndroid Build Coastguard Worker    if unionType == Any().TestSimpleTableWithEnum:
19*890232f2SAndroid Build Coastguard Worker        import MyGame.Example.TestSimpleTableWithEnum
20*890232f2SAndroid Build Coastguard Worker        return MyGame.Example.TestSimpleTableWithEnum.TestSimpleTableWithEnumT.InitFromBuf(table.Bytes, table.Pos)
21*890232f2SAndroid Build Coastguard Worker    if unionType == Any().MyGame_Example2_Monster:
22*890232f2SAndroid Build Coastguard Worker        import MyGame.Example2.Monster
23*890232f2SAndroid Build Coastguard Worker        return MyGame.Example2.Monster.MonsterT.InitFromBuf(table.Bytes, table.Pos)
24*890232f2SAndroid Build Coastguard Worker    return None
25