[TS] Fix generation of struct members in object api (#7148)

* Fix C/C++ Create<Type>Direct with sorted vectors

If a struct has a key the vector has to be sorted. To sort the vector
you can't use "const".

* Changes due to code review

* Improve code readability

* Add generate of JSON schema to string to lib

* option indent_step is supported

* Remove unused variables

* Fix break in test

* Fix style to be consistent with rest of the code

* [TS] Fix reserved words as arguments (#6955)

* [TS] Fix generation of reserved words in object api (#7106)

* [TS] Fix generation of object api

* [TS] Fix MakeCamel -> ConvertCase

* [TS] Add test for struct of struct of struct

* Update generated files

* Add missing files

* [TS] Fix query of null/undefined fields in object api
This commit is contained in:
tira-misu
2022-03-24 05:40:11 +01:00
committed by GitHub
parent 4213d91054
commit 2ad408697f
27 changed files with 1490 additions and 344 deletions

View File

@@ -0,0 +1,55 @@
<?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 StructOfStructsOfStructs extends Struct
{
/**
* @param int $_i offset
* @param ByteBuffer $_bb
* @return StructOfStructsOfStructs
**/
public function init($_i, ByteBuffer $_bb)
{
$this->bb_pos = $_i;
$this->bb = $_bb;
return $this;
}
/**
* @return StructOfStructs
*/
public function getA()
{
$obj = new StructOfStructs();
$obj->init($this->bb_pos + 0, $this->bb);
return $obj;
}
/**
* @return int offset
*/
public static function createStructOfStructsOfStructs(FlatBufferBuilder $builder, $a_a_id, $a_a_distance, $a_b_a, $a_b_b, $a_c_id, $a_c_distance)
{
$builder->prep(4, 20);
$builder->prep(4, 20);
$builder->prep(4, 8);
$builder->putUint($a_c_distance);
$builder->putUint($a_c_id);
$builder->prep(2, 4);
$builder->pad(1);
$builder->putSbyte($a_b_b);
$builder->putShort($a_b_a);
$builder->prep(4, 8);
$builder->putUint($a_a_distance);
$builder->putUint($a_a_id);
return $builder->offset();
}
}