mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 14:30:01 +00:00
[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:
@@ -35,6 +35,8 @@ struct Ability;
|
||||
|
||||
struct StructOfStructs;
|
||||
|
||||
struct StructOfStructsOfStructs;
|
||||
|
||||
struct Stat;
|
||||
struct StatBuilder;
|
||||
struct StatT;
|
||||
@@ -73,6 +75,8 @@ bool operator==(const Ability &lhs, const Ability &rhs);
|
||||
bool operator!=(const Ability &lhs, const Ability &rhs);
|
||||
bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs);
|
||||
bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs);
|
||||
bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
|
||||
bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
|
||||
bool operator==(const StatT &lhs, const StatT &rhs);
|
||||
bool operator!=(const StatT &lhs, const StatT &rhs);
|
||||
bool operator==(const ReferrableT &lhs, const ReferrableT &rhs);
|
||||
@@ -104,6 +108,8 @@ inline const flatbuffers::TypeTable *AbilityTypeTable();
|
||||
|
||||
inline const flatbuffers::TypeTable *StructOfStructsTypeTable();
|
||||
|
||||
inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable();
|
||||
|
||||
inline const flatbuffers::TypeTable *StatTypeTable();
|
||||
|
||||
inline const flatbuffers::TypeTable *ReferrableTypeTable();
|
||||
@@ -890,6 +896,39 @@ inline bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs) {
|
||||
}
|
||||
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructsOfStructs FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
MyGame::Example::StructOfStructs a_;
|
||||
|
||||
public:
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return StructOfStructsOfStructsTypeTable();
|
||||
}
|
||||
StructOfStructsOfStructs()
|
||||
: a_() {
|
||||
}
|
||||
StructOfStructsOfStructs(const MyGame::Example::StructOfStructs &_a)
|
||||
: a_(_a) {
|
||||
}
|
||||
const MyGame::Example::StructOfStructs &a() const {
|
||||
return a_;
|
||||
}
|
||||
MyGame::Example::StructOfStructs &mutable_a() {
|
||||
return a_;
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(StructOfStructsOfStructs, 20);
|
||||
|
||||
inline bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
|
||||
return
|
||||
(lhs.a() == rhs.a());
|
||||
}
|
||||
|
||||
inline bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Example
|
||||
|
||||
struct InParentNamespaceT : public flatbuffers::NativeTable {
|
||||
@@ -3704,6 +3743,23 @@ inline const flatbuffers::TypeTable *StructOfStructsTypeTable() {
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
MyGame::Example::StructOfStructsTypeTable
|
||||
};
|
||||
static const int64_t values[] = { 0, 20 };
|
||||
static const char * const names[] = {
|
||||
"a"
|
||||
};
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable *StatTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_STRING, 0, -1 },
|
||||
|
||||
Reference in New Issue
Block a user