1<?php 2// automatically generated by the FlatBuffers compiler, do not modify 3 4namespace MyGame\Example; 5 6use \Google\FlatBuffers\Struct; 7use \Google\FlatBuffers\Table; 8use \Google\FlatBuffers\ByteBuffer; 9use \Google\FlatBuffers\FlatBufferBuilder; 10 11class TestSimpleTableWithEnum extends Table 12{ 13 /** 14 * @param ByteBuffer $bb 15 * @return TestSimpleTableWithEnum 16 */ 17 public static function getRootAsTestSimpleTableWithEnum(ByteBuffer $bb) 18 { 19 $obj = new TestSimpleTableWithEnum(); 20 return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb)); 21 } 22 23 public static function TestSimpleTableWithEnumIdentifier() 24 { 25 return "MONS"; 26 } 27 28 public static function TestSimpleTableWithEnumBufferHasIdentifier(ByteBuffer $buf) 29 { 30 return self::__has_identifier($buf, self::TestSimpleTableWithEnumIdentifier()); 31 } 32 33 public static function TestSimpleTableWithEnumExtension() 34 { 35 return "mon"; 36 } 37 38 /** 39 * @param int $_i offset 40 * @param ByteBuffer $_bb 41 * @return TestSimpleTableWithEnum 42 **/ 43 public function init($_i, ByteBuffer $_bb) 44 { 45 $this->bb_pos = $_i; 46 $this->bb = $_bb; 47 return $this; 48 } 49 50 /** 51 * @return sbyte 52 */ 53 public function getColor() 54 { 55 $o = $this->__offset(4); 56 return $o != 0 ? $this->bb->getSbyte($o + $this->bb_pos) : \MyGame\Example\Color::Green; 57 } 58 59 /** 60 * @param FlatBufferBuilder $builder 61 * @return void 62 */ 63 public static function startTestSimpleTableWithEnum(FlatBufferBuilder $builder) 64 { 65 $builder->StartObject(1); 66 } 67 68 /** 69 * @param FlatBufferBuilder $builder 70 * @return TestSimpleTableWithEnum 71 */ 72 public static function createTestSimpleTableWithEnum(FlatBufferBuilder $builder, $color) 73 { 74 $builder->startObject(1); 75 self::addColor($builder, $color); 76 $o = $builder->endObject(); 77 return $o; 78 } 79 80 /** 81 * @param FlatBufferBuilder $builder 82 * @param sbyte 83 * @return void 84 */ 85 public static function addColor(FlatBufferBuilder $builder, $color) 86 { 87 $builder->addSbyteX(0, $color, 2); 88 } 89 90 /** 91 * @param FlatBufferBuilder $builder 92 * @return int table offset 93 */ 94 public static function endTestSimpleTableWithEnum(FlatBufferBuilder $builder) 95 { 96 $o = $builder->endObject(); 97 return $o; 98 } 99} 100