mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-03 11:24:13 +00:00
Fixed bug in convenient constructors for Java/C#
Also fixed Go unit tests not being up to date with recent schema changes. Change-Id: I42e619f9c5ea05f6f937c68a5c8a92462c46bce3 Tested: on Linux and Windows.
This commit is contained in:
@@ -463,7 +463,7 @@ static void GenStruct(const LanguageParameters &lang, const Parser &parser,
|
|||||||
if (has_no_struct_fields && num_fields) {
|
if (has_no_struct_fields && num_fields) {
|
||||||
// Generate a table constructor of the form:
|
// Generate a table constructor of the form:
|
||||||
// public static void createName(FlatBufferBuilder builder, args...)
|
// public static void createName(FlatBufferBuilder builder, args...)
|
||||||
code += " public static void " + FunctionStart(lang, 'C') + "reate";
|
code += " public static int " + FunctionStart(lang, 'C') + "reate";
|
||||||
code += struct_def.name;
|
code += struct_def.name;
|
||||||
code += "(FlatBufferBuilder builder";
|
code += "(FlatBufferBuilder builder";
|
||||||
for (auto it = struct_def.fields.vec.begin();
|
for (auto it = struct_def.fields.vec.begin();
|
||||||
@@ -495,8 +495,9 @@ static void GenStruct(const LanguageParameters &lang, const Parser &parser,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
code += " builder.";
|
code += " return " + struct_def.name + ".";
|
||||||
code += FunctionStart(lang, 'E') + "ndObject();\n }\n\n";
|
code += FunctionStart(lang, 'E') + "nd" + struct_def.name;
|
||||||
|
code += "(builder);\n }\n\n";
|
||||||
}
|
}
|
||||||
// Generate a set of static methods that allow table construction,
|
// Generate a set of static methods that allow table construction,
|
||||||
// of the form:
|
// of the form:
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Assert.cs" />
|
<Compile Include="Assert.cs" />
|
||||||
<Compile Include="ByteBufferTests.cs" />
|
<Compile Include="ByteBufferTests.cs" />
|
||||||
|
<Compile Include="MyGame\Example\Stat.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="FlatBuffersExampleTests.cs" />
|
<Compile Include="FlatBuffersExampleTests.cs" />
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ cp -u ./go_test.go ./go_gen/src/flatbuffers_test/
|
|||||||
# go -test -test.bench=. ...
|
# go -test -test.bench=. ...
|
||||||
GOPATH=${go_path} go test flatbuffers_test \
|
GOPATH=${go_path} go test flatbuffers_test \
|
||||||
--test.coverpkg=github.com/google/flatbuffers/go \
|
--test.coverpkg=github.com/google/flatbuffers/go \
|
||||||
--cpp_data=${test_dir}/monsterdata_test.bin \
|
--cpp_data=${test_dir}/monsterdata_test.mon \
|
||||||
--out_data=${test_dir}/monsterdata_go_wire.bin \
|
--out_data=${test_dir}/monsterdata_go_wire.mon \
|
||||||
--fuzz=true \
|
--fuzz=true \
|
||||||
--fuzz_fields=4 \
|
--fuzz_fields=4 \
|
||||||
--fuzz_objects=10000
|
--fuzz_objects=10000
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ public class Monster : Table {
|
|||||||
public Monster Enemy(Monster obj) { int o = __offset(28); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
public Monster Enemy(Monster obj) { int o = __offset(28); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
||||||
public byte Testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.Get(__vector(o) + j * 1) : (byte)0; }
|
public byte Testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.Get(__vector(o) + j * 1) : (byte)0; }
|
||||||
public int TestnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; }
|
public int TestnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; }
|
||||||
public Monster Testempty() { return Testempty(new Monster()); }
|
public Stat Testempty() { return Testempty(new Stat()); }
|
||||||
public Monster Testempty(Monster obj) { int o = __offset(32); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
public Stat Testempty(Stat obj) { int o = __offset(32); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
||||||
|
|
||||||
public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(15); }
|
public static void StartMonster(FlatBufferBuilder builder) { builder.StartObject(15); }
|
||||||
public static void AddPos(FlatBufferBuilder builder, int posOffset) { builder.AddStruct(0, posOffset, 0); }
|
public static void AddPos(FlatBufferBuilder builder, int posOffset) { builder.AddStruct(0, posOffset, 0); }
|
||||||
|
|||||||
@@ -139,8 +139,7 @@ func (rcv *Monster) TestarrayofstringLength() int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/// an example documentation comment: this will end up in the generated code
|
/// an example documentation comment: this will end up in the generated code multiline too
|
||||||
/// multiline too
|
|
||||||
func (rcv *Monster) Testarrayoftables(obj *Monster, j int) bool {
|
func (rcv *Monster) Testarrayoftables(obj *Monster, j int) bool {
|
||||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(26))
|
o := flatbuffers.UOffsetT(rcv._tab.Offset(26))
|
||||||
if o != 0 {
|
if o != 0 {
|
||||||
@@ -194,12 +193,12 @@ func (rcv *Monster) TestnestedflatbufferLength() int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rcv *Monster) Testempty(obj *Monster) *Monster {
|
func (rcv *Monster) Testempty(obj *Stat) *Stat {
|
||||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(32))
|
o := flatbuffers.UOffsetT(rcv._tab.Offset(32))
|
||||||
if o != 0 {
|
if o != 0 {
|
||||||
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
x := rcv._tab.Indirect(o + rcv._tab.Pos)
|
||||||
if obj == nil {
|
if obj == nil {
|
||||||
obj = new(Monster)
|
obj = new(Stat)
|
||||||
}
|
}
|
||||||
obj.Init(rcv._tab.Bytes, x)
|
obj.Init(rcv._tab.Bytes, x)
|
||||||
return obj
|
return obj
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public class Monster extends Table {
|
|||||||
public byte testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
|
public byte testnestedflatbuffer(int j) { int o = __offset(30); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
|
||||||
public int testnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; }
|
public int testnestedflatbufferLength() { int o = __offset(30); return o != 0 ? __vector_len(o) : 0; }
|
||||||
public ByteBuffer testnestedflatbufferAsByteBuffer() { return __vector_as_bytebuffer(30, 1); }
|
public ByteBuffer testnestedflatbufferAsByteBuffer() { return __vector_as_bytebuffer(30, 1); }
|
||||||
public Monster testempty() { return testempty(new Monster()); }
|
public Stat testempty() { return testempty(new Stat()); }
|
||||||
public Monster testempty(Monster obj) { int o = __offset(32); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
public Stat testempty(Stat obj) { int o = __offset(32); return o != 0 ? obj.__init(__indirect(o + bb_pos), bb) : null; }
|
||||||
|
|
||||||
public static void startMonster(FlatBufferBuilder builder) { builder.startObject(15); }
|
public static void startMonster(FlatBufferBuilder builder) { builder.startObject(15); }
|
||||||
public static void addPos(FlatBufferBuilder builder, int posOffset) { builder.addStruct(0, posOffset, 0); }
|
public static void addPos(FlatBufferBuilder builder, int posOffset) { builder.addStruct(0, posOffset, 0); }
|
||||||
|
|||||||
34
tests/MyGame/Example/Stat.cs
Normal file
34
tests/MyGame/Example/Stat.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// automatically generated, do not modify
|
||||||
|
|
||||||
|
namespace MyGame.Example
|
||||||
|
{
|
||||||
|
|
||||||
|
using FlatBuffers;
|
||||||
|
|
||||||
|
public class Stat : Table {
|
||||||
|
public static Stat GetRootAsStat(ByteBuffer _bb) { return (new Stat()).__init(_bb.GetInt(_bb.position()) + _bb.position(), _bb); }
|
||||||
|
public Stat __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
|
||||||
|
|
||||||
|
public string Id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
|
||||||
|
public long Val() { int o = __offset(6); return o != 0 ? bb.GetLong(o + bb_pos) : (long)0; }
|
||||||
|
|
||||||
|
public static int CreateStat(FlatBufferBuilder builder,
|
||||||
|
int id = 0,
|
||||||
|
long val = 0) {
|
||||||
|
builder.StartObject(2);
|
||||||
|
Stat.AddVal(builder, val);
|
||||||
|
Stat.AddId(builder, id);
|
||||||
|
return Stat.EndStat(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void StartStat(FlatBufferBuilder builder) { builder.StartObject(2); }
|
||||||
|
public static void AddId(FlatBufferBuilder builder, int idOffset) { builder.AddOffset(0, idOffset, 0); }
|
||||||
|
public static void AddVal(FlatBufferBuilder builder, long val) { builder.AddLong(1, val, 0); }
|
||||||
|
public static int EndStat(FlatBufferBuilder builder) {
|
||||||
|
int o = builder.EndObject();
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
36
tests/MyGame/Example/Stat.go
Normal file
36
tests/MyGame/Example/Stat.go
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// automatically generated, do not modify
|
||||||
|
|
||||||
|
package Example
|
||||||
|
|
||||||
|
import (
|
||||||
|
flatbuffers "github.com/google/flatbuffers/go"
|
||||||
|
)
|
||||||
|
type Stat struct {
|
||||||
|
_tab flatbuffers.Table
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *Stat) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||||
|
rcv._tab.Bytes = buf
|
||||||
|
rcv._tab.Pos = i
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *Stat) Id() string {
|
||||||
|
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||||
|
if o != 0 {
|
||||||
|
return rcv._tab.String(o + rcv._tab.Pos)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *Stat) Val() int64 {
|
||||||
|
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
|
||||||
|
if o != 0 {
|
||||||
|
return rcv._tab.GetInt64(o + rcv._tab.Pos)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func StatStart(builder *flatbuffers.Builder) { builder.StartObject(2) }
|
||||||
|
func StatAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) { builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0) }
|
||||||
|
func StatAddVal(builder *flatbuffers.Builder, val int64) { builder.PrependInt64Slot(1, val, 0) }
|
||||||
|
func StatEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { return builder.EndObject() }
|
||||||
35
tests/MyGame/Example/Stat.java
Normal file
35
tests/MyGame/Example/Stat.java
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// automatically generated, do not modify
|
||||||
|
|
||||||
|
package MyGame.Example;
|
||||||
|
|
||||||
|
import java.nio.*;
|
||||||
|
import java.lang.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.google.flatbuffers.*;
|
||||||
|
|
||||||
|
public class Stat extends Table {
|
||||||
|
public static Stat getRootAsStat(ByteBuffer _bb) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (new Stat()).__init(_bb.getInt(_bb.position()) + _bb.position(), _bb); }
|
||||||
|
public Stat __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
|
||||||
|
|
||||||
|
public String id() { int o = __offset(4); return o != 0 ? __string(o + bb_pos) : null; }
|
||||||
|
public ByteBuffer idAsByteBuffer() { return __vector_as_bytebuffer(4, 1); }
|
||||||
|
public long val() { int o = __offset(6); return o != 0 ? bb.getLong(o + bb_pos) : 0; }
|
||||||
|
|
||||||
|
public static int createStat(FlatBufferBuilder builder,
|
||||||
|
int id,
|
||||||
|
long val) {
|
||||||
|
builder.startObject(2);
|
||||||
|
Stat.addVal(builder, val);
|
||||||
|
Stat.addId(builder, id);
|
||||||
|
return Stat.endStat(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void startStat(FlatBufferBuilder builder) { builder.startObject(2); }
|
||||||
|
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
|
||||||
|
public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0); }
|
||||||
|
public static int endStat(FlatBufferBuilder builder) {
|
||||||
|
int o = builder.endObject();
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
@@ -21,9 +21,9 @@ var (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.StringVar(&cppData, "cpp_data", "",
|
flag.StringVar(&cppData, "cpp_data", "",
|
||||||
"location of monsterdata_test.bin to verify against (required)")
|
"location of monsterdata_test.mon to verify against (required)")
|
||||||
flag.StringVar(&javaData, "java_data", "",
|
flag.StringVar(&javaData, "java_data", "",
|
||||||
"location of monsterdata_java_wire.bin to verify against (optional)")
|
"location of monsterdata_java_wire.mon to verify against (optional)")
|
||||||
flag.StringVar(&outData, "out_data", "",
|
flag.StringVar(&outData, "out_data", "",
|
||||||
"location to write generated Go data")
|
"location to write generated Go data")
|
||||||
flag.BoolVar(&fuzz, "fuzz", false, "perform fuzzing")
|
flag.BoolVar(&fuzz, "fuzz", false, "perform fuzzing")
|
||||||
@@ -146,8 +146,8 @@ func CheckReadBuffer(buf []byte, offset flatbuffers.UOffsetT, fail func(string,
|
|||||||
fail(FailString("Pos.Test1", float64(3.0), got))
|
fail(FailString("Pos.Test1", float64(3.0), got))
|
||||||
}
|
}
|
||||||
|
|
||||||
if got := vec.Test2(); int8(4) != got {
|
if got := vec.Test2(); int8(2) != got {
|
||||||
fail(FailString("Pos.Test2", int8(4), got))
|
fail(FailString("Pos.Test2", int8(2), got))
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize a Test from Test3(...)
|
// initialize a Test from Test3(...)
|
||||||
@@ -190,8 +190,8 @@ func CheckReadBuffer(buf []byte, offset flatbuffers.UOffsetT, fail func(string,
|
|||||||
var monster2 example.Monster
|
var monster2 example.Monster
|
||||||
monster2.Init(table2.Bytes, table2.Pos)
|
monster2.Init(table2.Bytes, table2.Pos)
|
||||||
|
|
||||||
if got := monster2.Hp(); int16(20) != got {
|
if got := monster2.Name(); "Fred" != got {
|
||||||
fail(FailString("monster2.Hp()", int16(20), got))
|
fail(FailString("monster2.Name()", "Fred", got))
|
||||||
}
|
}
|
||||||
|
|
||||||
if got := monster.InventoryLength(); 5 != got {
|
if got := monster.InventoryLength(); 5 != got {
|
||||||
@@ -905,6 +905,7 @@ func CheckGeneratedBuild(fail func(string, ...interface{})) ([]byte, flatbuffers
|
|||||||
str := b.CreateString("MyMonster")
|
str := b.CreateString("MyMonster")
|
||||||
test1 := b.CreateString("test1")
|
test1 := b.CreateString("test1")
|
||||||
test2 := b.CreateString("test2")
|
test2 := b.CreateString("test2")
|
||||||
|
fred := b.CreateString("Fred")
|
||||||
|
|
||||||
example.MonsterStartInventoryVector(b, 5)
|
example.MonsterStartInventoryVector(b, 5)
|
||||||
b.PrependByte(4)
|
b.PrependByte(4)
|
||||||
@@ -915,7 +916,7 @@ func CheckGeneratedBuild(fail func(string, ...interface{})) ([]byte, flatbuffers
|
|||||||
inv := b.EndVector(5)
|
inv := b.EndVector(5)
|
||||||
|
|
||||||
example.MonsterStart(b)
|
example.MonsterStart(b)
|
||||||
example.MonsterAddHp(b, int16(20))
|
example.MonsterAddName(b, fred)
|
||||||
mon2 := example.MonsterEnd(b)
|
mon2 := example.MonsterEnd(b)
|
||||||
|
|
||||||
example.MonsterStartTest4Vector(b, 2)
|
example.MonsterStartTest4Vector(b, 2)
|
||||||
@@ -930,7 +931,7 @@ func CheckGeneratedBuild(fail func(string, ...interface{})) ([]byte, flatbuffers
|
|||||||
|
|
||||||
example.MonsterStart(b)
|
example.MonsterStart(b)
|
||||||
|
|
||||||
pos := example.CreateVec3(b, 1.0, 2.0, 3.0, 3.0, 4, 5, 6)
|
pos := example.CreateVec3(b, 1.0, 2.0, 3.0, 3.0, 2, 5, 6)
|
||||||
example.MonsterAddPos(b, pos)
|
example.MonsterAddPos(b, pos)
|
||||||
|
|
||||||
example.MonsterAddHp(b, 80)
|
example.MonsterAddHp(b, 80)
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ struct Vec3 (force_align: 16) {
|
|||||||
test3:Test;
|
test3:Test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table Stat {
|
||||||
|
id:string;
|
||||||
|
val:long;
|
||||||
|
}
|
||||||
|
|
||||||
table Monster {
|
table Monster {
|
||||||
pos:Vec3 (id: 0);
|
pos:Vec3 (id: 0);
|
||||||
hp:short = 100 (id: 2);
|
hp:short = 100 (id: 2);
|
||||||
@@ -35,7 +40,7 @@ table Monster {
|
|||||||
test:Any (id: 8);
|
test:Any (id: 8);
|
||||||
test4:[Test] (id: 9);
|
test4:[Test] (id: 9);
|
||||||
testnestedflatbuffer:[ubyte] (id:13, nested_flatbuffer: "Monster");
|
testnestedflatbuffer:[ubyte] (id:13, nested_flatbuffer: "Monster");
|
||||||
testempty:Monster (id:14);
|
testempty:Stat (id:14);
|
||||||
}
|
}
|
||||||
|
|
||||||
root_type Monster;
|
root_type Monster;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Example {
|
|||||||
|
|
||||||
struct Test;
|
struct Test;
|
||||||
struct Vec3;
|
struct Vec3;
|
||||||
|
struct Stat;
|
||||||
struct Monster;
|
struct Monster;
|
||||||
|
|
||||||
enum Color {
|
enum Color {
|
||||||
@@ -85,6 +86,40 @@ MANUALLY_ALIGNED_STRUCT(16) Vec3 {
|
|||||||
};
|
};
|
||||||
STRUCT_END(Vec3, 32);
|
STRUCT_END(Vec3, 32);
|
||||||
|
|
||||||
|
struct Stat : private flatbuffers::Table {
|
||||||
|
const flatbuffers::String *id() const { return GetPointer<const flatbuffers::String *>(4); }
|
||||||
|
int64_t val() const { return GetField<int64_t>(6, 0); }
|
||||||
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
|
return VerifyTableStart(verifier) &&
|
||||||
|
VerifyField<flatbuffers::uoffset_t>(verifier, 4 /* id */) &&
|
||||||
|
verifier.Verify(id()) &&
|
||||||
|
VerifyField<int64_t>(verifier, 6 /* val */) &&
|
||||||
|
verifier.EndTable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct StatBuilder {
|
||||||
|
flatbuffers::FlatBufferBuilder &fbb_;
|
||||||
|
flatbuffers::uoffset_t start_;
|
||||||
|
void add_id(flatbuffers::Offset<flatbuffers::String> id) { fbb_.AddOffset(4, id); }
|
||||||
|
void add_val(int64_t val) { fbb_.AddElement<int64_t>(6, val, 0); }
|
||||||
|
StatBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
|
StatBuilder &operator=(const StatBuilder &);
|
||||||
|
flatbuffers::Offset<Stat> Finish() {
|
||||||
|
auto o = flatbuffers::Offset<Stat>(fbb_.EndTable(start_, 2));
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb,
|
||||||
|
flatbuffers::Offset<flatbuffers::String> id = 0,
|
||||||
|
int64_t val = 0) {
|
||||||
|
StatBuilder builder_(_fbb);
|
||||||
|
builder_.add_val(val);
|
||||||
|
builder_.add_id(id);
|
||||||
|
return builder_.Finish();
|
||||||
|
}
|
||||||
|
|
||||||
struct Monster : private flatbuffers::Table {
|
struct Monster : private flatbuffers::Table {
|
||||||
const Vec3 *pos() const { return GetStruct<const Vec3 *>(4); }
|
const Vec3 *pos() const { return GetStruct<const Vec3 *>(4); }
|
||||||
int16_t mana() const { return GetField<int16_t>(6, 150); }
|
int16_t mana() const { return GetField<int16_t>(6, 150); }
|
||||||
@@ -102,7 +137,7 @@ struct Monster : private flatbuffers::Table {
|
|||||||
const Monster *enemy() const { return GetPointer<const Monster *>(28); }
|
const Monster *enemy() const { return GetPointer<const Monster *>(28); }
|
||||||
const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(30); }
|
const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(30); }
|
||||||
const Monster *testnestedflatbuffer_nested_root() { return flatbuffers::GetRoot<Monster>(testnestedflatbuffer()->Data()); }
|
const Monster *testnestedflatbuffer_nested_root() { return flatbuffers::GetRoot<Monster>(testnestedflatbuffer()->Data()); }
|
||||||
const Monster *testempty() const { return GetPointer<const Monster *>(32); }
|
const Stat *testempty() const { return GetPointer<const Stat *>(32); }
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyField<Vec3>(verifier, 4 /* pos */) &&
|
VerifyField<Vec3>(verifier, 4 /* pos */) &&
|
||||||
@@ -150,7 +185,7 @@ struct MonsterBuilder {
|
|||||||
void add_testarrayoftables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables) { fbb_.AddOffset(26, testarrayoftables); }
|
void add_testarrayoftables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables) { fbb_.AddOffset(26, testarrayoftables); }
|
||||||
void add_enemy(flatbuffers::Offset<Monster> enemy) { fbb_.AddOffset(28, enemy); }
|
void add_enemy(flatbuffers::Offset<Monster> enemy) { fbb_.AddOffset(28, enemy); }
|
||||||
void add_testnestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer) { fbb_.AddOffset(30, testnestedflatbuffer); }
|
void add_testnestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer) { fbb_.AddOffset(30, testnestedflatbuffer); }
|
||||||
void add_testempty(flatbuffers::Offset<Monster> testempty) { fbb_.AddOffset(32, testempty); }
|
void add_testempty(flatbuffers::Offset<Stat> testempty) { fbb_.AddOffset(32, testempty); }
|
||||||
MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||||
MonsterBuilder &operator=(const MonsterBuilder &);
|
MonsterBuilder &operator=(const MonsterBuilder &);
|
||||||
flatbuffers::Offset<Monster> Finish() {
|
flatbuffers::Offset<Monster> Finish() {
|
||||||
@@ -174,7 +209,7 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder
|
|||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables = 0,
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables = 0,
|
||||||
flatbuffers::Offset<Monster> enemy = 0,
|
flatbuffers::Offset<Monster> enemy = 0,
|
||||||
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer = 0,
|
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer = 0,
|
||||||
flatbuffers::Offset<Monster> testempty = 0) {
|
flatbuffers::Offset<Stat> testempty = 0) {
|
||||||
MonsterBuilder builder_(_fbb);
|
MonsterBuilder builder_(_fbb);
|
||||||
builder_.add_testempty(testempty);
|
builder_.add_testempty(testempty);
|
||||||
builder_.add_testnestedflatbuffer(testnestedflatbuffer);
|
builder_.add_testnestedflatbuffer(testnestedflatbuffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user