Minireflect fixed array (#6129)

* CMakeLists: also really generate optional_scalars as needed by test elsewhere

* [C++] Handle fixed-length array in minireflection

Fixes #6128
This commit is contained in:
Mark Nauwelaerts
2020-09-23 02:57:01 +02:00
committed by GitHub
parent 96d5e35977
commit 34d67b425e
16 changed files with 127 additions and 73 deletions

View File

@@ -341,21 +341,22 @@ inline const flatbuffers::TypeTable *TestEnumTypeTable() {
"C"
};
static const flatbuffers::TypeTable tt = {
flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, names
flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
};
return &tt;
}
inline const flatbuffers::TypeTable *NestedStructTypeTable() {
static const flatbuffers::TypeCode type_codes[] = {
{ flatbuffers::ET_SEQUENCE, 0, -1 },
{ flatbuffers::ET_INT, 1, -1 },
{ flatbuffers::ET_CHAR, 0, 0 },
{ flatbuffers::ET_SEQUENCE, 0, 0 },
{ flatbuffers::ET_SEQUENCE, 0, -1 }
{ flatbuffers::ET_CHAR, 1, 0 },
{ flatbuffers::ET_LONG, 1, -1 }
};
static const flatbuffers::TypeFunction type_refs[] = {
MyGame::Example::TestEnumTypeTable
};
static const int16_t array_sizes[] = { 2, 2, 2, };
static const int64_t values[] = { 0, 8, 9, 16, 32 };
static const char * const names[] = {
"a",
@@ -364,7 +365,7 @@ inline const flatbuffers::TypeTable *NestedStructTypeTable() {
"d"
};
static const flatbuffers::TypeTable tt = {
flatbuffers::ST_STRUCT, 4, type_codes, type_refs, values, names
flatbuffers::ST_STRUCT, 4, type_codes, type_refs, array_sizes, values, names
};
return &tt;
}
@@ -372,15 +373,16 @@ inline const flatbuffers::TypeTable *NestedStructTypeTable() {
inline const flatbuffers::TypeTable *ArrayStructTypeTable() {
static const flatbuffers::TypeCode type_codes[] = {
{ flatbuffers::ET_FLOAT, 0, -1 },
{ flatbuffers::ET_SEQUENCE, 0, -1 },
{ flatbuffers::ET_INT, 1, -1 },
{ flatbuffers::ET_CHAR, 0, -1 },
{ flatbuffers::ET_SEQUENCE, 0, 0 },
{ flatbuffers::ET_SEQUENCE, 1, 0 },
{ flatbuffers::ET_INT, 0, -1 },
{ flatbuffers::ET_SEQUENCE, 0, -1 }
{ flatbuffers::ET_LONG, 1, -1 }
};
static const flatbuffers::TypeFunction type_refs[] = {
MyGame::Example::NestedStructTypeTable
};
static const int16_t array_sizes[] = { 15, 2, 2, };
static const int64_t values[] = { 0, 4, 64, 72, 136, 144, 160 };
static const char * const names[] = {
"a",
@@ -391,7 +393,7 @@ inline const flatbuffers::TypeTable *ArrayStructTypeTable() {
"f"
};
static const flatbuffers::TypeTable tt = {
flatbuffers::ST_STRUCT, 6, type_codes, type_refs, values, names
flatbuffers::ST_STRUCT, 6, type_codes, type_refs, array_sizes, values, names
};
return &tt;
}
@@ -407,7 +409,7 @@ inline const flatbuffers::TypeTable *ArrayTableTypeTable() {
"a"
};
static const flatbuffers::TypeTable tt = {
flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, names
flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
};
return &tt;
}