mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Improve generated comparisons for tables (#6486)
* Improve generated comparisons for tables Previously, the generated code called std::unique_ptr<>::operator== on non-scalar members, which would be correct only if the member was null on both sides. After this CL, comparison is done on the pointed-to values (including using a default-constructed value if the pointer is null). * Don't equate null Tables with all defaults Also removes the cost of default-constructing tables for comparisons. * Regenerate code * fix formatting
This commit is contained in:
@@ -235,24 +235,6 @@ struct MonsterT : public flatbuffers::NativeTable {
|
||||
std::vector<MyGame::Sample::Vec3> path{};
|
||||
};
|
||||
|
||||
inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return
|
||||
(lhs.pos == rhs.pos) &&
|
||||
(lhs.mana == rhs.mana) &&
|
||||
(lhs.hp == rhs.hp) &&
|
||||
(lhs.name == rhs.name) &&
|
||||
(lhs.inventory == rhs.inventory) &&
|
||||
(lhs.color == rhs.color) &&
|
||||
(lhs.weapons == rhs.weapons) &&
|
||||
(lhs.equipped == rhs.equipped) &&
|
||||
(lhs.path == rhs.path);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef MonsterT NativeTableType;
|
||||
typedef MonsterBuilder Builder;
|
||||
@@ -470,17 +452,6 @@ struct WeaponT : public flatbuffers::NativeTable {
|
||||
int16_t damage = 0;
|
||||
};
|
||||
|
||||
inline bool operator==(const WeaponT &lhs, const WeaponT &rhs) {
|
||||
return
|
||||
(lhs.name == rhs.name) &&
|
||||
(lhs.damage == rhs.damage);
|
||||
}
|
||||
|
||||
inline bool operator!=(const WeaponT &lhs, const WeaponT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct Weapon FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef WeaponT NativeTableType;
|
||||
typedef WeaponBuilder Builder;
|
||||
@@ -559,6 +530,25 @@ inline flatbuffers::Offset<Weapon> CreateWeaponDirect(
|
||||
|
||||
flatbuffers::Offset<Weapon> CreateWeapon(flatbuffers::FlatBufferBuilder &_fbb, const WeaponT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return
|
||||
((lhs.pos == rhs.pos) || (lhs.pos && rhs.pos && *lhs.pos == *rhs.pos)) &&
|
||||
(lhs.mana == rhs.mana) &&
|
||||
(lhs.hp == rhs.hp) &&
|
||||
(lhs.name == rhs.name) &&
|
||||
(lhs.inventory == rhs.inventory) &&
|
||||
(lhs.color == rhs.color) &&
|
||||
(lhs.weapons == rhs.weapons) &&
|
||||
(lhs.equipped == rhs.equipped) &&
|
||||
(lhs.path == rhs.path);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<MonsterT>(new MonsterT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -612,6 +602,18 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder
|
||||
_path);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const WeaponT &lhs, const WeaponT &rhs) {
|
||||
return
|
||||
(lhs.name == rhs.name) &&
|
||||
(lhs.damage == rhs.damage);
|
||||
}
|
||||
|
||||
inline bool operator!=(const WeaponT &lhs, const WeaponT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline WeaponT *Weapon::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<WeaponT>(new WeaponT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
@@ -1819,7 +1819,18 @@ class CppGenerator : public BaseGenerator {
|
||||
field.value.type.element != BASE_TYPE_UTYPE)) {
|
||||
if (!compare_op.empty()) { compare_op += " &&\n "; }
|
||||
auto accessor = Name(field) + accessSuffix;
|
||||
compare_op += "(lhs." + accessor + " == rhs." + accessor + ")";
|
||||
if (struct_def.fixed ||
|
||||
field.value.type.base_type != BASE_TYPE_STRUCT) {
|
||||
compare_op += "(lhs." + accessor + " == rhs." + accessor + ")";
|
||||
} else {
|
||||
// Deep compare of std::unique_ptr. Null is not equal to empty.
|
||||
std::string both_null =
|
||||
"(lhs." + accessor + " == rhs." + accessor + ")";
|
||||
std::string not_null_and_equal = "(lhs." + accessor + " && rhs." +
|
||||
accessor + " && *lhs." + accessor +
|
||||
" == *rhs." + accessor + ")";
|
||||
compare_op += "(" + both_null + " || " + not_null_and_equal + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1885,10 +1896,19 @@ class CppGenerator : public BaseGenerator {
|
||||
GenOperatorNewDelete(struct_def);
|
||||
GenDefaultConstructor(struct_def);
|
||||
code_ += "};";
|
||||
if (opts_.gen_compare) GenCompareOperator(struct_def);
|
||||
code_ += "";
|
||||
}
|
||||
|
||||
void GenNativeTablePost(const StructDef &struct_def) {
|
||||
if (opts_.gen_compare) {
|
||||
const auto native_name = NativeName(Name(struct_def), &struct_def, opts_);
|
||||
code_.SetValue("STRUCT_NAME", Name(struct_def));
|
||||
code_.SetValue("NATIVE_NAME", native_name);
|
||||
GenCompareOperator(struct_def);
|
||||
code_ += "";
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the code to call the appropriate Verify function(s) for a field.
|
||||
void GenVerifyCall(const FieldDef &field, const char *prefix) {
|
||||
code_.SetValue("PRE", prefix);
|
||||
@@ -2999,6 +3019,8 @@ class CppGenerator : public BaseGenerator {
|
||||
|
||||
// Generate code for tables that needs to come after the regular definition.
|
||||
void GenTablePost(const StructDef &struct_def) {
|
||||
if (opts_.generate_object_based_api) { GenNativeTablePost(struct_def); }
|
||||
|
||||
code_.SetValue("STRUCT_NAME", Name(struct_def));
|
||||
code_.SetValue("NATIVE_NAME",
|
||||
NativeName(Name(struct_def), &struct_def, opts_));
|
||||
|
||||
@@ -267,16 +267,6 @@ struct ArrayTableT : public flatbuffers::NativeTable {
|
||||
flatbuffers::unique_ptr<MyGame::Example::ArrayStruct> a{};
|
||||
};
|
||||
|
||||
inline bool operator==(const ArrayTableT &lhs, const ArrayTableT &rhs) {
|
||||
return
|
||||
(lhs.a == rhs.a);
|
||||
}
|
||||
|
||||
inline bool operator!=(const ArrayTableT &lhs, const ArrayTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct ArrayTable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef ArrayTableT NativeTableType;
|
||||
typedef ArrayTableBuilder Builder;
|
||||
@@ -330,6 +320,17 @@ inline flatbuffers::Offset<ArrayTable> CreateArrayTable(
|
||||
|
||||
flatbuffers::Offset<ArrayTable> CreateArrayTable(flatbuffers::FlatBufferBuilder &_fbb, const ArrayTableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const ArrayTableT &lhs, const ArrayTableT &rhs) {
|
||||
return
|
||||
((lhs.a == rhs.a) || (lhs.a && rhs.a && *lhs.a == *rhs.a));
|
||||
}
|
||||
|
||||
inline bool operator!=(const ArrayTableT &lhs, const ArrayTableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline ArrayTableT *ArrayTable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<ArrayTableT>(new ArrayTableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
@@ -31,25 +31,6 @@ struct MonsterExtraT : public flatbuffers::NativeTable {
|
||||
std::vector<float> fvec{};
|
||||
};
|
||||
|
||||
inline bool operator==(const MonsterExtraT &lhs, const MonsterExtraT &rhs) {
|
||||
return
|
||||
(lhs.d0 == rhs.d0) &&
|
||||
(lhs.d1 == rhs.d1) &&
|
||||
(lhs.d2 == rhs.d2) &&
|
||||
(lhs.d3 == rhs.d3) &&
|
||||
(lhs.f0 == rhs.f0) &&
|
||||
(lhs.f1 == rhs.f1) &&
|
||||
(lhs.f2 == rhs.f2) &&
|
||||
(lhs.f3 == rhs.f3) &&
|
||||
(lhs.dvec == rhs.dvec) &&
|
||||
(lhs.fvec == rhs.fvec);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterExtraT &lhs, const MonsterExtraT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct MonsterExtra FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef MonsterExtraT NativeTableType;
|
||||
typedef MonsterExtraBuilder Builder;
|
||||
@@ -250,6 +231,26 @@ inline flatbuffers::Offset<MonsterExtra> CreateMonsterExtraDirect(
|
||||
|
||||
flatbuffers::Offset<MonsterExtra> CreateMonsterExtra(flatbuffers::FlatBufferBuilder &_fbb, const MonsterExtraT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const MonsterExtraT &lhs, const MonsterExtraT &rhs) {
|
||||
return
|
||||
(lhs.d0 == rhs.d0) &&
|
||||
(lhs.d1 == rhs.d1) &&
|
||||
(lhs.d2 == rhs.d2) &&
|
||||
(lhs.d3 == rhs.d3) &&
|
||||
(lhs.f0 == rhs.f0) &&
|
||||
(lhs.f1 == rhs.f1) &&
|
||||
(lhs.f2 == rhs.f2) &&
|
||||
(lhs.f3 == rhs.f3) &&
|
||||
(lhs.dvec == rhs.dvec) &&
|
||||
(lhs.fvec == rhs.fvec);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterExtraT &lhs, const MonsterExtraT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline MonsterExtraT *MonsterExtra::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<MonsterExtraT>(new MonsterExtraT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
@@ -842,15 +842,6 @@ struct InParentNamespaceT : public flatbuffers::NativeTable {
|
||||
typedef InParentNamespace TableType;
|
||||
};
|
||||
|
||||
inline bool operator==(const InParentNamespaceT &, const InParentNamespaceT &) {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct InParentNamespace FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef InParentNamespaceT NativeTableType;
|
||||
typedef InParentNamespaceBuilder Builder;
|
||||
@@ -895,15 +886,6 @@ struct MonsterT : public flatbuffers::NativeTable {
|
||||
typedef Monster TableType;
|
||||
};
|
||||
|
||||
inline bool operator==(const MonsterT &, const MonsterT &) {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef MonsterT NativeTableType;
|
||||
typedef MonsterBuilder Builder;
|
||||
@@ -951,16 +933,6 @@ struct TestSimpleTableWithEnumT : public flatbuffers::NativeTable {
|
||||
MyGame::Example::Color color = MyGame::Example::Color_Green;
|
||||
};
|
||||
|
||||
inline bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
|
||||
return
|
||||
(lhs.color == rhs.color);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef TestSimpleTableWithEnumT NativeTableType;
|
||||
typedef TestSimpleTableWithEnumBuilder Builder;
|
||||
@@ -1021,18 +993,6 @@ struct StatT : public flatbuffers::NativeTable {
|
||||
uint16_t count = 0;
|
||||
};
|
||||
|
||||
inline bool operator==(const StatT &lhs, const StatT &rhs) {
|
||||
return
|
||||
(lhs.id == rhs.id) &&
|
||||
(lhs.val == rhs.val) &&
|
||||
(lhs.count == rhs.count);
|
||||
}
|
||||
|
||||
inline bool operator!=(const StatT &lhs, const StatT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef StatT NativeTableType;
|
||||
typedef StatBuilder Builder;
|
||||
@@ -1137,16 +1097,6 @@ struct ReferrableT : public flatbuffers::NativeTable {
|
||||
uint64_t id = 0;
|
||||
};
|
||||
|
||||
inline bool operator==(const ReferrableT &lhs, const ReferrableT &rhs) {
|
||||
return
|
||||
(lhs.id == rhs.id);
|
||||
}
|
||||
|
||||
inline bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct Referrable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef ReferrableT NativeTableType;
|
||||
typedef ReferrableBuilder Builder;
|
||||
@@ -1257,62 +1207,6 @@ struct MonsterT : public flatbuffers::NativeTable {
|
||||
std::vector<flatbuffers::unique_ptr<MyGame::Example::StatT>> scalar_key_sorted_tables{};
|
||||
};
|
||||
|
||||
inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return
|
||||
(lhs.pos == rhs.pos) &&
|
||||
(lhs.mana == rhs.mana) &&
|
||||
(lhs.hp == rhs.hp) &&
|
||||
(lhs.name == rhs.name) &&
|
||||
(lhs.inventory == rhs.inventory) &&
|
||||
(lhs.color == rhs.color) &&
|
||||
(lhs.test == rhs.test) &&
|
||||
(lhs.test4 == rhs.test4) &&
|
||||
(lhs.testarrayofstring == rhs.testarrayofstring) &&
|
||||
(lhs.testarrayoftables == rhs.testarrayoftables) &&
|
||||
(lhs.enemy == rhs.enemy) &&
|
||||
(lhs.testnestedflatbuffer == rhs.testnestedflatbuffer) &&
|
||||
(lhs.testempty == rhs.testempty) &&
|
||||
(lhs.testbool == rhs.testbool) &&
|
||||
(lhs.testhashs32_fnv1 == rhs.testhashs32_fnv1) &&
|
||||
(lhs.testhashu32_fnv1 == rhs.testhashu32_fnv1) &&
|
||||
(lhs.testhashs64_fnv1 == rhs.testhashs64_fnv1) &&
|
||||
(lhs.testhashu64_fnv1 == rhs.testhashu64_fnv1) &&
|
||||
(lhs.testhashs32_fnv1a == rhs.testhashs32_fnv1a) &&
|
||||
(lhs.testhashu32_fnv1a == rhs.testhashu32_fnv1a) &&
|
||||
(lhs.testhashs64_fnv1a == rhs.testhashs64_fnv1a) &&
|
||||
(lhs.testhashu64_fnv1a == rhs.testhashu64_fnv1a) &&
|
||||
(lhs.testarrayofbools == rhs.testarrayofbools) &&
|
||||
(lhs.testf == rhs.testf) &&
|
||||
(lhs.testf2 == rhs.testf2) &&
|
||||
(lhs.testf3 == rhs.testf3) &&
|
||||
(lhs.testarrayofstring2 == rhs.testarrayofstring2) &&
|
||||
(lhs.testarrayofsortedstruct == rhs.testarrayofsortedstruct) &&
|
||||
(lhs.flex == rhs.flex) &&
|
||||
(lhs.test5 == rhs.test5) &&
|
||||
(lhs.vector_of_longs == rhs.vector_of_longs) &&
|
||||
(lhs.vector_of_doubles == rhs.vector_of_doubles) &&
|
||||
(lhs.parent_namespace_test == rhs.parent_namespace_test) &&
|
||||
(lhs.vector_of_referrables == rhs.vector_of_referrables) &&
|
||||
(lhs.single_weak_reference == rhs.single_weak_reference) &&
|
||||
(lhs.vector_of_weak_references == rhs.vector_of_weak_references) &&
|
||||
(lhs.vector_of_strong_referrables == rhs.vector_of_strong_referrables) &&
|
||||
(lhs.co_owning_reference == rhs.co_owning_reference) &&
|
||||
(lhs.vector_of_co_owning_references == rhs.vector_of_co_owning_references) &&
|
||||
(lhs.non_owning_reference == rhs.non_owning_reference) &&
|
||||
(lhs.vector_of_non_owning_references == rhs.vector_of_non_owning_references) &&
|
||||
(lhs.any_unique == rhs.any_unique) &&
|
||||
(lhs.any_ambiguous == rhs.any_ambiguous) &&
|
||||
(lhs.vector_of_enums == rhs.vector_of_enums) &&
|
||||
(lhs.signed_enum == rhs.signed_enum) &&
|
||||
(lhs.testrequirednestedflatbuffer == rhs.testrequirednestedflatbuffer) &&
|
||||
(lhs.scalar_key_sorted_tables == rhs.scalar_key_sorted_tables);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
/// an example documentation comment: "monster object"
|
||||
struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef MonsterT NativeTableType;
|
||||
@@ -2242,27 +2136,6 @@ struct TypeAliasesT : public flatbuffers::NativeTable {
|
||||
std::vector<double> vf64{};
|
||||
};
|
||||
|
||||
inline bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
|
||||
return
|
||||
(lhs.i8 == rhs.i8) &&
|
||||
(lhs.u8 == rhs.u8) &&
|
||||
(lhs.i16 == rhs.i16) &&
|
||||
(lhs.u16 == rhs.u16) &&
|
||||
(lhs.i32 == rhs.i32) &&
|
||||
(lhs.u32 == rhs.u32) &&
|
||||
(lhs.i64 == rhs.i64) &&
|
||||
(lhs.u64 == rhs.u64) &&
|
||||
(lhs.f32 == rhs.f32) &&
|
||||
(lhs.f64 == rhs.f64) &&
|
||||
(lhs.v8 == rhs.v8) &&
|
||||
(lhs.vf64 == rhs.vf64);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct TypeAliases FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef TypeAliasesT NativeTableType;
|
||||
typedef TypeAliasesBuilder Builder;
|
||||
@@ -2495,6 +2368,16 @@ flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilde
|
||||
|
||||
} // namespace Example
|
||||
|
||||
|
||||
inline bool operator==(const InParentNamespaceT &, const InParentNamespaceT &) {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline InParentNamespaceT *InParentNamespace::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<InParentNamespaceT>(new InParentNamespaceT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -2520,6 +2403,16 @@ inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffer
|
||||
|
||||
namespace Example2 {
|
||||
|
||||
|
||||
inline bool operator==(const MonsterT &, const MonsterT &) {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<MonsterT>(new MonsterT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -2547,6 +2440,17 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder
|
||||
|
||||
namespace Example {
|
||||
|
||||
|
||||
inline bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
|
||||
return
|
||||
(lhs.color == rhs.color);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TestSimpleTableWithEnumT *TestSimpleTableWithEnum::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TestSimpleTableWithEnumT>(new TestSimpleTableWithEnumT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -2573,6 +2477,19 @@ inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnu
|
||||
_color);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const StatT &lhs, const StatT &rhs) {
|
||||
return
|
||||
(lhs.id == rhs.id) &&
|
||||
(lhs.val == rhs.val) &&
|
||||
(lhs.count == rhs.count);
|
||||
}
|
||||
|
||||
inline bool operator!=(const StatT &lhs, const StatT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline StatT *Stat::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<StatT>(new StatT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -2605,6 +2522,17 @@ inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb
|
||||
_count);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const ReferrableT &lhs, const ReferrableT &rhs) {
|
||||
return
|
||||
(lhs.id == rhs.id);
|
||||
}
|
||||
|
||||
inline bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline ReferrableT *Referrable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<ReferrableT>(new ReferrableT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -2631,6 +2559,63 @@ inline flatbuffers::Offset<Referrable> CreateReferrable(flatbuffers::FlatBufferB
|
||||
_id);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return
|
||||
((lhs.pos == rhs.pos) || (lhs.pos && rhs.pos && *lhs.pos == *rhs.pos)) &&
|
||||
(lhs.mana == rhs.mana) &&
|
||||
(lhs.hp == rhs.hp) &&
|
||||
(lhs.name == rhs.name) &&
|
||||
(lhs.inventory == rhs.inventory) &&
|
||||
(lhs.color == rhs.color) &&
|
||||
(lhs.test == rhs.test) &&
|
||||
(lhs.test4 == rhs.test4) &&
|
||||
(lhs.testarrayofstring == rhs.testarrayofstring) &&
|
||||
(lhs.testarrayoftables == rhs.testarrayoftables) &&
|
||||
((lhs.enemy == rhs.enemy) || (lhs.enemy && rhs.enemy && *lhs.enemy == *rhs.enemy)) &&
|
||||
(lhs.testnestedflatbuffer == rhs.testnestedflatbuffer) &&
|
||||
((lhs.testempty == rhs.testempty) || (lhs.testempty && rhs.testempty && *lhs.testempty == *rhs.testempty)) &&
|
||||
(lhs.testbool == rhs.testbool) &&
|
||||
(lhs.testhashs32_fnv1 == rhs.testhashs32_fnv1) &&
|
||||
(lhs.testhashu32_fnv1 == rhs.testhashu32_fnv1) &&
|
||||
(lhs.testhashs64_fnv1 == rhs.testhashs64_fnv1) &&
|
||||
(lhs.testhashu64_fnv1 == rhs.testhashu64_fnv1) &&
|
||||
(lhs.testhashs32_fnv1a == rhs.testhashs32_fnv1a) &&
|
||||
(lhs.testhashu32_fnv1a == rhs.testhashu32_fnv1a) &&
|
||||
(lhs.testhashs64_fnv1a == rhs.testhashs64_fnv1a) &&
|
||||
(lhs.testhashu64_fnv1a == rhs.testhashu64_fnv1a) &&
|
||||
(lhs.testarrayofbools == rhs.testarrayofbools) &&
|
||||
(lhs.testf == rhs.testf) &&
|
||||
(lhs.testf2 == rhs.testf2) &&
|
||||
(lhs.testf3 == rhs.testf3) &&
|
||||
(lhs.testarrayofstring2 == rhs.testarrayofstring2) &&
|
||||
(lhs.testarrayofsortedstruct == rhs.testarrayofsortedstruct) &&
|
||||
(lhs.flex == rhs.flex) &&
|
||||
(lhs.test5 == rhs.test5) &&
|
||||
(lhs.vector_of_longs == rhs.vector_of_longs) &&
|
||||
(lhs.vector_of_doubles == rhs.vector_of_doubles) &&
|
||||
((lhs.parent_namespace_test == rhs.parent_namespace_test) || (lhs.parent_namespace_test && rhs.parent_namespace_test && *lhs.parent_namespace_test == *rhs.parent_namespace_test)) &&
|
||||
(lhs.vector_of_referrables == rhs.vector_of_referrables) &&
|
||||
(lhs.single_weak_reference == rhs.single_weak_reference) &&
|
||||
(lhs.vector_of_weak_references == rhs.vector_of_weak_references) &&
|
||||
(lhs.vector_of_strong_referrables == rhs.vector_of_strong_referrables) &&
|
||||
(lhs.co_owning_reference == rhs.co_owning_reference) &&
|
||||
(lhs.vector_of_co_owning_references == rhs.vector_of_co_owning_references) &&
|
||||
(lhs.non_owning_reference == rhs.non_owning_reference) &&
|
||||
(lhs.vector_of_non_owning_references == rhs.vector_of_non_owning_references) &&
|
||||
(lhs.any_unique == rhs.any_unique) &&
|
||||
(lhs.any_ambiguous == rhs.any_ambiguous) &&
|
||||
(lhs.vector_of_enums == rhs.vector_of_enums) &&
|
||||
(lhs.signed_enum == rhs.signed_enum) &&
|
||||
(lhs.testrequirednestedflatbuffer == rhs.testrequirednestedflatbuffer) &&
|
||||
(lhs.scalar_key_sorted_tables == rhs.scalar_key_sorted_tables);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<MonsterT>(new MonsterT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -2811,6 +2796,28 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder
|
||||
_scalar_key_sorted_tables);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
|
||||
return
|
||||
(lhs.i8 == rhs.i8) &&
|
||||
(lhs.u8 == rhs.u8) &&
|
||||
(lhs.i16 == rhs.i16) &&
|
||||
(lhs.u16 == rhs.u16) &&
|
||||
(lhs.i32 == rhs.i32) &&
|
||||
(lhs.u32 == rhs.u32) &&
|
||||
(lhs.i64 == rhs.i64) &&
|
||||
(lhs.u64 == rhs.u64) &&
|
||||
(lhs.f32 == rhs.f32) &&
|
||||
(lhs.f64 == rhs.f64) &&
|
||||
(lhs.v8 == rhs.v8) &&
|
||||
(lhs.vf64 == rhs.vf64);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TypeAliasesT *TypeAliases::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TypeAliasesT>(new TypeAliasesT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
@@ -215,16 +215,6 @@ struct TableInNestedNST : public flatbuffers::NativeTable {
|
||||
int32_t foo = 0;
|
||||
};
|
||||
|
||||
inline bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return
|
||||
(lhs.foo == rhs.foo);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef TableInNestedNST NativeTableType;
|
||||
typedef TableInNestedNSBuilder Builder;
|
||||
@@ -281,6 +271,17 @@ inline flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(
|
||||
|
||||
flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return
|
||||
(lhs.foo == rhs.foo);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInNestedNST *TableInNestedNS::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInNestedNST>(new TableInNestedNST());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
@@ -68,19 +68,6 @@ struct TableInFirstNST : public flatbuffers::NativeTable {
|
||||
flatbuffers::unique_ptr<NamespaceA::NamespaceB::StructInNestedNS> foo_struct{};
|
||||
};
|
||||
|
||||
inline bool operator==(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return
|
||||
(lhs.foo_table == rhs.foo_table) &&
|
||||
(lhs.foo_enum == rhs.foo_enum) &&
|
||||
(lhs.foo_union == rhs.foo_union) &&
|
||||
(lhs.foo_struct == rhs.foo_struct);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct TableInFirstNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef TableInFirstNST NativeTableType;
|
||||
typedef TableInFirstNSBuilder Builder;
|
||||
@@ -209,17 +196,6 @@ struct TableInCT : public flatbuffers::NativeTable {
|
||||
flatbuffers::unique_ptr<NamespaceA::SecondTableInAT> refer_to_a2{};
|
||||
};
|
||||
|
||||
inline bool operator==(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return
|
||||
(lhs.refer_to_a1 == rhs.refer_to_a1) &&
|
||||
(lhs.refer_to_a2 == rhs.refer_to_a2);
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct TableInC FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef TableInCT NativeTableType;
|
||||
typedef TableInCBuilder Builder;
|
||||
@@ -303,16 +279,6 @@ struct SecondTableInAT : public flatbuffers::NativeTable {
|
||||
flatbuffers::unique_ptr<NamespaceC::TableInCT> refer_to_c{};
|
||||
};
|
||||
|
||||
inline bool operator==(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return
|
||||
(lhs.refer_to_c == rhs.refer_to_c);
|
||||
}
|
||||
|
||||
inline bool operator!=(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct SecondTableInA FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef SecondTableInAT NativeTableType;
|
||||
typedef SecondTableInABuilder Builder;
|
||||
@@ -370,6 +336,20 @@ inline flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(
|
||||
|
||||
flatbuffers::Offset<SecondTableInA> CreateSecondTableInA(flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return
|
||||
((lhs.foo_table == rhs.foo_table) || (lhs.foo_table && rhs.foo_table && *lhs.foo_table == *rhs.foo_table)) &&
|
||||
(lhs.foo_enum == rhs.foo_enum) &&
|
||||
(lhs.foo_union == rhs.foo_union) &&
|
||||
((lhs.foo_struct == rhs.foo_struct) || (lhs.foo_struct && rhs.foo_struct && *lhs.foo_struct == *rhs.foo_struct));
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInFirstNST &lhs, const TableInFirstNST &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInFirstNST *TableInFirstNS::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInFirstNST>(new TableInFirstNST());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -412,6 +392,18 @@ inline flatbuffers::Offset<TableInFirstNS> CreateTableInFirstNS(flatbuffers::Fla
|
||||
|
||||
namespace NamespaceC {
|
||||
|
||||
|
||||
inline bool operator==(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return
|
||||
((lhs.refer_to_a1 == rhs.refer_to_a1) || (lhs.refer_to_a1 && rhs.refer_to_a1 && *lhs.refer_to_a1 == *rhs.refer_to_a1)) &&
|
||||
((lhs.refer_to_a2 == rhs.refer_to_a2) || (lhs.refer_to_a2 && rhs.refer_to_a2 && *lhs.refer_to_a2 == *rhs.refer_to_a2));
|
||||
}
|
||||
|
||||
inline bool operator!=(const TableInCT &lhs, const TableInCT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline TableInCT *TableInC::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInCT>(new TableInCT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -445,6 +437,17 @@ inline flatbuffers::Offset<TableInC> CreateTableInC(flatbuffers::FlatBufferBuild
|
||||
|
||||
namespace NamespaceA {
|
||||
|
||||
|
||||
inline bool operator==(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return
|
||||
((lhs.refer_to_c == rhs.refer_to_c) || (lhs.refer_to_c && rhs.refer_to_c && *lhs.refer_to_c == *rhs.refer_to_c));
|
||||
}
|
||||
|
||||
inline bool operator!=(const SecondTableInAT &lhs, const SecondTableInAT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline SecondTableInAT *SecondTableInA::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<SecondTableInAT>(new SecondTableInAT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
@@ -90,51 +90,6 @@ struct ScalarStuffT : public flatbuffers::NativeTable {
|
||||
optional_scalars::OptionalByte default_enum = optional_scalars::OptionalByte_One;
|
||||
};
|
||||
|
||||
inline bool operator==(const ScalarStuffT &lhs, const ScalarStuffT &rhs) {
|
||||
return
|
||||
(lhs.just_i8 == rhs.just_i8) &&
|
||||
(lhs.maybe_i8 == rhs.maybe_i8) &&
|
||||
(lhs.default_i8 == rhs.default_i8) &&
|
||||
(lhs.just_u8 == rhs.just_u8) &&
|
||||
(lhs.maybe_u8 == rhs.maybe_u8) &&
|
||||
(lhs.default_u8 == rhs.default_u8) &&
|
||||
(lhs.just_i16 == rhs.just_i16) &&
|
||||
(lhs.maybe_i16 == rhs.maybe_i16) &&
|
||||
(lhs.default_i16 == rhs.default_i16) &&
|
||||
(lhs.just_u16 == rhs.just_u16) &&
|
||||
(lhs.maybe_u16 == rhs.maybe_u16) &&
|
||||
(lhs.default_u16 == rhs.default_u16) &&
|
||||
(lhs.just_i32 == rhs.just_i32) &&
|
||||
(lhs.maybe_i32 == rhs.maybe_i32) &&
|
||||
(lhs.default_i32 == rhs.default_i32) &&
|
||||
(lhs.just_u32 == rhs.just_u32) &&
|
||||
(lhs.maybe_u32 == rhs.maybe_u32) &&
|
||||
(lhs.default_u32 == rhs.default_u32) &&
|
||||
(lhs.just_i64 == rhs.just_i64) &&
|
||||
(lhs.maybe_i64 == rhs.maybe_i64) &&
|
||||
(lhs.default_i64 == rhs.default_i64) &&
|
||||
(lhs.just_u64 == rhs.just_u64) &&
|
||||
(lhs.maybe_u64 == rhs.maybe_u64) &&
|
||||
(lhs.default_u64 == rhs.default_u64) &&
|
||||
(lhs.just_f32 == rhs.just_f32) &&
|
||||
(lhs.maybe_f32 == rhs.maybe_f32) &&
|
||||
(lhs.default_f32 == rhs.default_f32) &&
|
||||
(lhs.just_f64 == rhs.just_f64) &&
|
||||
(lhs.maybe_f64 == rhs.maybe_f64) &&
|
||||
(lhs.default_f64 == rhs.default_f64) &&
|
||||
(lhs.just_bool == rhs.just_bool) &&
|
||||
(lhs.maybe_bool == rhs.maybe_bool) &&
|
||||
(lhs.default_bool == rhs.default_bool) &&
|
||||
(lhs.just_enum == rhs.just_enum) &&
|
||||
(lhs.maybe_enum == rhs.maybe_enum) &&
|
||||
(lhs.default_enum == rhs.default_enum);
|
||||
}
|
||||
|
||||
inline bool operator!=(const ScalarStuffT &lhs, const ScalarStuffT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct ScalarStuff FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef ScalarStuffT NativeTableType;
|
||||
typedef ScalarStuffBuilder Builder;
|
||||
@@ -643,6 +598,52 @@ inline flatbuffers::Offset<ScalarStuff> CreateScalarStuff(
|
||||
|
||||
flatbuffers::Offset<ScalarStuff> CreateScalarStuff(flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const ScalarStuffT &lhs, const ScalarStuffT &rhs) {
|
||||
return
|
||||
(lhs.just_i8 == rhs.just_i8) &&
|
||||
(lhs.maybe_i8 == rhs.maybe_i8) &&
|
||||
(lhs.default_i8 == rhs.default_i8) &&
|
||||
(lhs.just_u8 == rhs.just_u8) &&
|
||||
(lhs.maybe_u8 == rhs.maybe_u8) &&
|
||||
(lhs.default_u8 == rhs.default_u8) &&
|
||||
(lhs.just_i16 == rhs.just_i16) &&
|
||||
(lhs.maybe_i16 == rhs.maybe_i16) &&
|
||||
(lhs.default_i16 == rhs.default_i16) &&
|
||||
(lhs.just_u16 == rhs.just_u16) &&
|
||||
(lhs.maybe_u16 == rhs.maybe_u16) &&
|
||||
(lhs.default_u16 == rhs.default_u16) &&
|
||||
(lhs.just_i32 == rhs.just_i32) &&
|
||||
(lhs.maybe_i32 == rhs.maybe_i32) &&
|
||||
(lhs.default_i32 == rhs.default_i32) &&
|
||||
(lhs.just_u32 == rhs.just_u32) &&
|
||||
(lhs.maybe_u32 == rhs.maybe_u32) &&
|
||||
(lhs.default_u32 == rhs.default_u32) &&
|
||||
(lhs.just_i64 == rhs.just_i64) &&
|
||||
(lhs.maybe_i64 == rhs.maybe_i64) &&
|
||||
(lhs.default_i64 == rhs.default_i64) &&
|
||||
(lhs.just_u64 == rhs.just_u64) &&
|
||||
(lhs.maybe_u64 == rhs.maybe_u64) &&
|
||||
(lhs.default_u64 == rhs.default_u64) &&
|
||||
(lhs.just_f32 == rhs.just_f32) &&
|
||||
(lhs.maybe_f32 == rhs.maybe_f32) &&
|
||||
(lhs.default_f32 == rhs.default_f32) &&
|
||||
(lhs.just_f64 == rhs.just_f64) &&
|
||||
(lhs.maybe_f64 == rhs.maybe_f64) &&
|
||||
(lhs.default_f64 == rhs.default_f64) &&
|
||||
(lhs.just_bool == rhs.just_bool) &&
|
||||
(lhs.maybe_bool == rhs.maybe_bool) &&
|
||||
(lhs.default_bool == rhs.default_bool) &&
|
||||
(lhs.just_enum == rhs.just_enum) &&
|
||||
(lhs.maybe_enum == rhs.maybe_enum) &&
|
||||
(lhs.default_enum == rhs.default_enum);
|
||||
}
|
||||
|
||||
inline bool operator!=(const ScalarStuffT &lhs, const ScalarStuffT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline ScalarStuffT *ScalarStuff::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<ScalarStuffT>(new ScalarStuffT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
@@ -3320,6 +3320,31 @@ void EqualOperatorTest() {
|
||||
TEST_EQ(b == a, true);
|
||||
TEST_EQ(b != a, false);
|
||||
|
||||
a.enemy.reset(new MonsterT());
|
||||
TEST_EQ(b != a, true);
|
||||
a.enemy->mana = 33;
|
||||
TEST_EQ(b == a, false);
|
||||
TEST_EQ(b != a, true);
|
||||
|
||||
b.enemy.reset(new MonsterT());
|
||||
TEST_EQ(b == a, false);
|
||||
TEST_EQ(b != a, true);
|
||||
b.enemy->mana = 33;
|
||||
TEST_EQ(b == a, true);
|
||||
TEST_EQ(b != a, false);
|
||||
|
||||
a.enemy.reset(nullptr);
|
||||
TEST_EQ(b == a, false);
|
||||
TEST_EQ(b != a, true);
|
||||
b.enemy->mana = 150;
|
||||
TEST_EQ(b == a, false);
|
||||
TEST_EQ(b != a, true);
|
||||
a.enemy.reset(new MonsterT());
|
||||
TEST_EQ(b == a, true);
|
||||
TEST_EQ(b != a, false);
|
||||
|
||||
b.enemy.reset(nullptr);
|
||||
|
||||
b.test.type = Any_Monster;
|
||||
TEST_EQ(b == a, false);
|
||||
TEST_EQ(b != a, true);
|
||||
|
||||
@@ -274,16 +274,6 @@ struct AttackerT : public flatbuffers::NativeTable {
|
||||
int32_t sword_attack_damage = 0;
|
||||
};
|
||||
|
||||
inline bool operator==(const AttackerT &lhs, const AttackerT &rhs) {
|
||||
return
|
||||
(lhs.sword_attack_damage == rhs.sword_attack_damage);
|
||||
}
|
||||
|
||||
inline bool operator!=(const AttackerT &lhs, const AttackerT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct Attacker FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef AttackerT NativeTableType;
|
||||
typedef AttackerBuilder Builder;
|
||||
@@ -349,17 +339,6 @@ struct MovieT : public flatbuffers::NativeTable {
|
||||
std::vector<CharacterUnion> characters{};
|
||||
};
|
||||
|
||||
inline bool operator==(const MovieT &lhs, const MovieT &rhs) {
|
||||
return
|
||||
(lhs.main_character == rhs.main_character) &&
|
||||
(lhs.characters == rhs.characters);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MovieT &lhs, const MovieT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
struct Movie FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef MovieT NativeTableType;
|
||||
typedef MovieBuilder Builder;
|
||||
@@ -490,6 +469,17 @@ inline flatbuffers::Offset<Movie> CreateMovieDirect(
|
||||
|
||||
flatbuffers::Offset<Movie> CreateMovie(flatbuffers::FlatBufferBuilder &_fbb, const MovieT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
|
||||
inline bool operator==(const AttackerT &lhs, const AttackerT &rhs) {
|
||||
return
|
||||
(lhs.sword_attack_damage == rhs.sword_attack_damage);
|
||||
}
|
||||
|
||||
inline bool operator!=(const AttackerT &lhs, const AttackerT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline AttackerT *Attacker::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<AttackerT>(new AttackerT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
@@ -516,6 +506,18 @@ inline flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuild
|
||||
_sword_attack_damage);
|
||||
}
|
||||
|
||||
|
||||
inline bool operator==(const MovieT &lhs, const MovieT &rhs) {
|
||||
return
|
||||
(lhs.main_character == rhs.main_character) &&
|
||||
(lhs.characters == rhs.characters);
|
||||
}
|
||||
|
||||
inline bool operator!=(const MovieT &lhs, const MovieT &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
||||
inline MovieT *Movie::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<MovieT>(new MovieT());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
|
||||
Reference in New Issue
Block a user