mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 09:08:17 +00:00
- add flatbuffers::span - add new constructor for `struct` with `array` - add some test for flatbuffers::span and 'arrays_test.fbs'
This commit is contained in:
@@ -92,12 +92,24 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) NestedStruct FLATBUFFERS_FINAL_CLASS {
|
||||
padding0__(0),
|
||||
padding1__(0),
|
||||
d_() {
|
||||
(void)padding0__;
|
||||
(void)padding1__;
|
||||
}
|
||||
NestedStruct(flatbuffers::span<const int32_t, 2> _a, MyGame::Example::TestEnum _b, flatbuffers::span<const MyGame::Example::TestEnum, 2> _c, flatbuffers::span<const int64_t, 2> _d)
|
||||
: b_(flatbuffers::EndianScalar(static_cast<int8_t>(_b))),
|
||||
padding0__(0),
|
||||
padding1__(0) {
|
||||
flatbuffers::CastToArray(a_).CopyFromSpan(_a);
|
||||
flatbuffers::CastToArrayOfEnum<MyGame::Example::TestEnum>(c_).CopyFromSpan(_c);
|
||||
(void)padding0__;
|
||||
(void)padding1__;
|
||||
flatbuffers::CastToArray(d_).CopyFromSpan(_d);
|
||||
}
|
||||
const flatbuffers::Array<int32_t, 2> *a() const {
|
||||
return reinterpret_cast<const flatbuffers::Array<int32_t, 2> *>(a_);
|
||||
return &flatbuffers::CastToArray(a_);
|
||||
}
|
||||
flatbuffers::Array<int32_t, 2> *mutable_a() {
|
||||
return reinterpret_cast<flatbuffers::Array<int32_t, 2> *>(a_);
|
||||
return &flatbuffers::CastToArray(a_);
|
||||
}
|
||||
MyGame::Example::TestEnum b() const {
|
||||
return static_cast<MyGame::Example::TestEnum>(flatbuffers::EndianScalar(b_));
|
||||
@@ -106,16 +118,16 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) NestedStruct FLATBUFFERS_FINAL_CLASS {
|
||||
flatbuffers::WriteScalar(&b_, static_cast<int8_t>(_b));
|
||||
}
|
||||
const flatbuffers::Array<MyGame::Example::TestEnum, 2> *c() const {
|
||||
return reinterpret_cast<const flatbuffers::Array<MyGame::Example::TestEnum, 2> *>(c_);
|
||||
return &flatbuffers::CastToArrayOfEnum<MyGame::Example::TestEnum>(c_);
|
||||
}
|
||||
flatbuffers::Array<MyGame::Example::TestEnum, 2> *mutable_c() {
|
||||
return reinterpret_cast<flatbuffers::Array<MyGame::Example::TestEnum, 2> *>(c_);
|
||||
return &flatbuffers::CastToArrayOfEnum<MyGame::Example::TestEnum>(c_);
|
||||
}
|
||||
const flatbuffers::Array<int64_t, 2> *d() const {
|
||||
return reinterpret_cast<const flatbuffers::Array<int64_t, 2> *>(d_);
|
||||
return &flatbuffers::CastToArray(d_);
|
||||
}
|
||||
flatbuffers::Array<int64_t, 2> *mutable_d() {
|
||||
return reinterpret_cast<flatbuffers::Array<int64_t, 2> *>(d_);
|
||||
return &flatbuffers::CastToArray(d_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(NestedStruct, 32);
|
||||
@@ -175,6 +187,26 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) ArrayStruct FLATBUFFERS_FINAL_CLASS {
|
||||
e_(flatbuffers::EndianScalar(_e)),
|
||||
padding3__(0),
|
||||
f_() {
|
||||
(void)padding0__;
|
||||
(void)padding1__;
|
||||
(void)padding2__;
|
||||
(void)padding3__;
|
||||
}
|
||||
ArrayStruct(float _a, flatbuffers::span<const int32_t, 15> _b, int8_t _c, flatbuffers::span<const MyGame::Example::NestedStruct, 2> _d, int32_t _e, flatbuffers::span<const int64_t, 2> _f)
|
||||
: a_(flatbuffers::EndianScalar(_a)),
|
||||
c_(flatbuffers::EndianScalar(_c)),
|
||||
padding0__(0),
|
||||
padding1__(0),
|
||||
padding2__(0),
|
||||
e_(flatbuffers::EndianScalar(_e)),
|
||||
padding3__(0) {
|
||||
flatbuffers::CastToArray(b_).CopyFromSpan(_b);
|
||||
(void)padding0__;
|
||||
(void)padding1__;
|
||||
(void)padding2__;
|
||||
flatbuffers::CastToArray(d_).CopyFromSpan(_d);
|
||||
(void)padding3__;
|
||||
flatbuffers::CastToArray(f_).CopyFromSpan(_f);
|
||||
}
|
||||
float a() const {
|
||||
return flatbuffers::EndianScalar(a_);
|
||||
@@ -183,10 +215,10 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) ArrayStruct FLATBUFFERS_FINAL_CLASS {
|
||||
flatbuffers::WriteScalar(&a_, _a);
|
||||
}
|
||||
const flatbuffers::Array<int32_t, 15> *b() const {
|
||||
return reinterpret_cast<const flatbuffers::Array<int32_t, 15> *>(b_);
|
||||
return &flatbuffers::CastToArray(b_);
|
||||
}
|
||||
flatbuffers::Array<int32_t, 15> *mutable_b() {
|
||||
return reinterpret_cast<flatbuffers::Array<int32_t, 15> *>(b_);
|
||||
return &flatbuffers::CastToArray(b_);
|
||||
}
|
||||
int8_t c() const {
|
||||
return flatbuffers::EndianScalar(c_);
|
||||
@@ -195,10 +227,10 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) ArrayStruct FLATBUFFERS_FINAL_CLASS {
|
||||
flatbuffers::WriteScalar(&c_, _c);
|
||||
}
|
||||
const flatbuffers::Array<MyGame::Example::NestedStruct, 2> *d() const {
|
||||
return reinterpret_cast<const flatbuffers::Array<MyGame::Example::NestedStruct, 2> *>(d_);
|
||||
return &flatbuffers::CastToArray(d_);
|
||||
}
|
||||
flatbuffers::Array<MyGame::Example::NestedStruct, 2> *mutable_d() {
|
||||
return reinterpret_cast<flatbuffers::Array<MyGame::Example::NestedStruct, 2> *>(d_);
|
||||
return &flatbuffers::CastToArray(d_);
|
||||
}
|
||||
int32_t e() const {
|
||||
return flatbuffers::EndianScalar(e_);
|
||||
@@ -207,10 +239,10 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) ArrayStruct FLATBUFFERS_FINAL_CLASS {
|
||||
flatbuffers::WriteScalar(&e_, _e);
|
||||
}
|
||||
const flatbuffers::Array<int64_t, 2> *f() const {
|
||||
return reinterpret_cast<const flatbuffers::Array<int64_t, 2> *>(f_);
|
||||
return &flatbuffers::CastToArray(f_);
|
||||
}
|
||||
flatbuffers::Array<int64_t, 2> *mutable_f() {
|
||||
return reinterpret_cast<flatbuffers::Array<int64_t, 2> *>(f_);
|
||||
return &flatbuffers::CastToArray(f_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(ArrayStruct, 160);
|
||||
|
||||
Reference in New Issue
Block a user