Files
flatbuffers/tests/union_vector/Attacker.php
Kamil Rojewski 46bb05d952 Vector of unions for TS/JS and PHP (#4404)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests
2017-08-11 09:24:36 -07:00

95 lines
2.2 KiB
PHP

<?php
// automatically generated by the FlatBuffers compiler, do not modify
namespace ;
use \Google\FlatBuffers\Struct;
use \Google\FlatBuffers\Table;
use \Google\FlatBuffers\ByteBuffer;
use \Google\FlatBuffers\FlatBufferBuilder;
class Attacker extends Table
{
/**
* @param ByteBuffer $bb
* @return Attacker
*/
public static function getRootAsAttacker(ByteBuffer $bb)
{
$obj = new Attacker();
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
}
public static function AttackerIdentifier()
{
return "MOVI";
}
public static function AttackerBufferHasIdentifier(ByteBuffer $buf)
{
return self::__has_identifier($buf, self::AttackerIdentifier());
}
/**
* @param int $_i offset
* @param ByteBuffer $_bb
* @return Attacker
**/
public function init($_i, ByteBuffer $_bb)
{
$this->bb_pos = $_i;
$this->bb = $_bb;
return $this;
}
/**
* @return int
*/
public function getSwordAttackDamage()
{
$o = $this->__offset(4);
return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0;
}
/**
* @param FlatBufferBuilder $builder
* @return void
*/
public static function startAttacker(FlatBufferBuilder $builder)
{
$builder->StartObject(1);
}
/**
* @param FlatBufferBuilder $builder
* @return Attacker
*/
public static function createAttacker(FlatBufferBuilder $builder, $sword_attack_damage)
{
$builder->startObject(1);
self::addSwordAttackDamage($builder, $sword_attack_damage);
$o = $builder->endObject();
return $o;
}
/**
* @param FlatBufferBuilder $builder
* @param int
* @return void
*/
public static function addSwordAttackDamage(FlatBufferBuilder $builder, $swordAttackDamage)
{
$builder->addIntX(0, $swordAttackDamage, 0);
}
/**
* @param FlatBufferBuilder $builder
* @return int table offset
*/
public static function endAttacker(FlatBufferBuilder $builder)
{
$o = $builder->endObject();
return $o;
}
}