Add inequality operator (inspired from #263) (#5257)

This commit is contained in:
LouisP
2019-03-25 20:04:51 +01:00
committed by Wouter van Oortmerssen
parent a7461433c6
commit 88abae649c
6 changed files with 157 additions and 0 deletions

View File

@@ -45,21 +45,31 @@ struct TypeAliasesT;
} // namespace Example
bool operator==(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
namespace Example2 {
bool operator==(const MonsterT &lhs, const MonsterT &rhs);
bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
} // namespace Example2
namespace Example {
bool operator==(const Test &lhs, const Test &rhs);
bool operator!=(const Test &lhs, const Test &rhs);
bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
bool operator==(const Vec3 &lhs, const Vec3 &rhs);
bool operator!=(const Vec3 &lhs, const Vec3 &rhs);
bool operator==(const Ability &lhs, const Ability &rhs);
bool operator!=(const Ability &lhs, const Ability &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);
bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs);
bool operator==(const MonsterT &lhs, const MonsterT &rhs);
bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
} // namespace Example
@@ -260,6 +270,11 @@ inline bool operator==(const AnyUnion &lhs, const AnyUnion &rhs) {
}
}
}
inline bool operator!=(const AnyUnion &lhs, const AnyUnion &rhs) {
return !(lhs == rhs);
}
bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type);
bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
@@ -396,6 +411,11 @@ inline bool operator==(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesU
}
}
}
inline bool operator!=(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
return !(lhs == rhs);
}
bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type);
bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
@@ -505,6 +525,11 @@ inline bool operator==(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAl
}
}
}
inline bool operator!=(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
return !(lhs == rhs);
}
bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type);
bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
@@ -545,6 +570,11 @@ inline bool operator==(const Test &lhs, const Test &rhs) {
(lhs.b() == rhs.b());
}
inline bool operator!=(const Test &lhs, const Test &rhs) {
return !(lhs == rhs);
}
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS {
private:
float x_;
@@ -624,6 +654,11 @@ inline bool operator==(const Vec3 &lhs, const Vec3 &rhs) {
(lhs.test3() == rhs.test3());
}
inline bool operator!=(const Vec3 &lhs, const Vec3 &rhs) {
return !(lhs == rhs);
}
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
private:
uint32_t id_;
@@ -664,6 +699,11 @@ inline bool operator==(const Ability &lhs, const Ability &rhs) {
(lhs.distance() == rhs.distance());
}
inline bool operator!=(const Ability &lhs, const Ability &rhs) {
return !(lhs == rhs);
}
} // namespace Example
struct InParentNamespaceT : public flatbuffers::NativeTable {
@@ -676,6 +716,11 @@ 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;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
@@ -725,6 +770,11 @@ 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;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
@@ -779,6 +829,11 @@ inline bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTabl
(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;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
@@ -849,6 +904,11 @@ inline bool operator==(const StatT &lhs, const StatT &rhs) {
(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;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
@@ -954,6 +1014,11 @@ inline bool operator==(const ReferrableT &lhs, const ReferrableT &rhs) {
(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;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
@@ -1128,6 +1193,11 @@ inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
(lhs.vector_of_enums == rhs.vector_of_enums);
}
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;
@@ -2040,6 +2110,11 @@ inline bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
(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;
static const flatbuffers::TypeTable *MiniReflectTypeTable() {