Fixed whole-number float default values missing a .0 suffix.

A previous commit that added "f" for C++/Java/C# would break
on gcc of constants like 3f, which are now output as 3.0f

Tested: on Linux

Change-Id: If9cabbe3c6d6948a5050b8b123bda9c06e181f52
This commit is contained in:
Wouter van Oortmerssen
2016-04-18 11:48:53 -07:00
parent 791c83aa7e
commit 4d7890c2c9
12 changed files with 82 additions and 11 deletions

View File

@@ -342,22 +342,31 @@ class Monster extends Table
return $o != 0 ? $this->bb->getFloat($o + $this->bb_pos) : 3.14159;
}
/**
* @return float
*/
public function getTestf2()
{
$o = $this->__offset(56);
return $o != 0 ? $this->bb->getFloat($o + $this->bb_pos) : 3.0;
}
/**
* @param FlatBufferBuilder $builder
* @return void
*/
public static function startMonster(FlatBufferBuilder $builder)
{
$builder->StartObject(26);
$builder->StartObject(27);
}
/**
* @param FlatBufferBuilder $builder
* @return Monster
*/
public static function createMonster(FlatBufferBuilder $builder, $pos, $mana, $hp, $name, $inventory, $color, $test_type, $test, $test4, $testarrayofstring, $testarrayoftables, $enemy, $testnestedflatbuffer, $testempty, $testbool, $testhashs32_fnv1, $testhashu32_fnv1, $testhashs64_fnv1, $testhashu64_fnv1, $testhashs32_fnv1a, $testhashu32_fnv1a, $testhashs64_fnv1a, $testhashu64_fnv1a, $testarrayofbools, $testf)
public static function createMonster(FlatBufferBuilder $builder, $pos, $mana, $hp, $name, $inventory, $color, $test_type, $test, $test4, $testarrayofstring, $testarrayoftables, $enemy, $testnestedflatbuffer, $testempty, $testbool, $testhashs32_fnv1, $testhashu32_fnv1, $testhashs64_fnv1, $testhashu64_fnv1, $testhashs32_fnv1a, $testhashu32_fnv1a, $testhashs64_fnv1a, $testhashu64_fnv1a, $testarrayofbools, $testf, $testf2)
{
$builder->startObject(26);
$builder->startObject(27);
self::addPos($builder, $pos);
self::addMana($builder, $mana);
self::addHp($builder, $hp);
@@ -383,6 +392,7 @@ class Monster extends Table
self::addTesthashu64Fnv1a($builder, $testhashu64_fnv1a);
self::addTestarrayofbools($builder, $testarrayofbools);
self::addTestf($builder, $testf);
self::addTestf2($builder, $testf2);
$o = $builder->endObject();
$builder->required($o, 10); // name
return $o;
@@ -777,6 +787,16 @@ class Monster extends Table
$builder->addFloatX(25, $testf, 3.14159);
}
/**
* @param FlatBufferBuilder $builder
* @param float
* @return void
*/
public static function addTestf2(FlatBufferBuilder $builder, $testf2)
{
$builder->addFloatX(26, $testf2, 3.0);
}
/**
* @param FlatBufferBuilder $builder
* @return int table offset