summaryrefslogtreecommitdiff
path: root/tests/MyGame/Example/TestSimpleTableWithEnum.php
blob: 6429f8d8e3d37a7dd3d706ae961a9f2e4a81c7a1 (plain)
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
<?php
// automatically generated by the FlatBuffers compiler, do not modify

namespace MyGame\Example;

use \Google\FlatBuffers\Struct;
use \Google\FlatBuffers\Table;
use \Google\FlatBuffers\ByteBuffer;
use \Google\FlatBuffers\FlatBufferBuilder;

class TestSimpleTableWithEnum extends Table
{
    /**
     * @param ByteBuffer $bb
     * @return TestSimpleTableWithEnum
     */
    public static function getRootAsTestSimpleTableWithEnum(ByteBuffer $bb)
    {
        $obj = new TestSimpleTableWithEnum();
        return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
    }

    public static function TestSimpleTableWithEnumIdentifier()
    {
        return "MONS";
    }

    public static function TestSimpleTableWithEnumBufferHasIdentifier(ByteBuffer $buf)
    {
        return self::__has_identifier($buf, self::TestSimpleTableWithEnumIdentifier());
    }

    public static function TestSimpleTableWithEnumExtension()
    {
        return "mon";
    }

    /**
     * @param int $_i offset
     * @param ByteBuffer $_bb
     * @return TestSimpleTableWithEnum
     **/
    public function init($_i, ByteBuffer $_bb)
    {
        $this->bb_pos = $_i;
        $this->bb = $_bb;
        return $this;
    }

    /**
     * @return byte
     */
    public function getColor()
    {
        $o = $this->__offset(4);
        return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : \MyGame\Example\Color::Green;
    }

    /**
     * @param FlatBufferBuilder $builder
     * @return void
     */
    public static function startTestSimpleTableWithEnum(FlatBufferBuilder $builder)
    {
        $builder->StartObject(1);
    }

    /**
     * @param FlatBufferBuilder $builder
     * @return TestSimpleTableWithEnum
     */
    public static function createTestSimpleTableWithEnum(FlatBufferBuilder $builder, $color)
    {
        $builder->startObject(1);
        self::addColor($builder, $color);
        $o = $builder->endObject();
        return $o;
    }

    /**
     * @param FlatBufferBuilder $builder
     * @param byte
     * @return void
     */
    public static function addColor(FlatBufferBuilder $builder, $color)
    {
        $builder->addByteX(0, $color, 2);
    }

    /**
     * @param FlatBufferBuilder $builder
     * @return int table offset
     */
    public static function endTestSimpleTableWithEnum(FlatBufferBuilder $builder)
    {
        $o = $builder->endObject();
        return $o;
    }
}