Skip to content

Commit

Permalink
Regenerate the test code using scripts/generate_code.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrh1 committed Oct 27, 2024
1 parent e0ad5cb commit 4405b95
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
86 changes: 86 additions & 0 deletions tests/cpp17/generated_cpp17/monster_test_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct TypeAliases;
struct TypeAliasesBuilder;
struct TypeAliasesT;

template<typename T> struct EnumTraits;

} // namespace Example

inline const ::flatbuffers::TypeTable *InParentNamespaceTypeTable();
Expand Down Expand Up @@ -4211,6 +4213,90 @@ inline const ::flatbuffers::TypeTable *TypeAliasesTypeTable() {
return &tt;
}

template<>
struct EnumTraits<Color> {
constexpr static auto type_table = ColorTypeTable;
constexpr static auto name = EnumNameColor;
};

inline EnumTraits<Color> EnumValTraits(Color) {
return EnumTraits<Color>{};
}

inline const char *GetEnumName(Color e) {
return EnumValTraits(e).name(e);
}

template<>
struct EnumTraits<Race> {
constexpr static auto type_table = RaceTypeTable;
constexpr static auto name = EnumNameRace;
};

inline EnumTraits<Race> EnumValTraits(Race) {
return EnumTraits<Race>{};
}

inline const char *GetEnumName(Race e) {
return EnumValTraits(e).name(e);
}

template<>
struct EnumTraits<LongEnum> {
constexpr static auto type_table = LongEnumTypeTable;
constexpr static auto name = EnumNameLongEnum;
};

inline EnumTraits<LongEnum> EnumValTraits(LongEnum) {
return EnumTraits<LongEnum>{};
}

inline const char *GetEnumName(LongEnum e) {
return EnumValTraits(e).name(e);
}

template<>
struct EnumTraits<Any> {
constexpr static auto type_table = AnyTypeTable;
constexpr static auto name = EnumNameAny;
};

inline EnumTraits<Any> EnumValTraits(Any) {
return EnumTraits<Any>{};
}

inline const char *GetEnumName(Any e) {
return EnumValTraits(e).name(e);
}

template<>
struct EnumTraits<AnyUniqueAliases> {
constexpr static auto type_table = AnyUniqueAliasesTypeTable;
constexpr static auto name = EnumNameAnyUniqueAliases;
};

inline EnumTraits<AnyUniqueAliases> EnumValTraits(AnyUniqueAliases) {
return EnumTraits<AnyUniqueAliases>{};
}

inline const char *GetEnumName(AnyUniqueAliases e) {
return EnumValTraits(e).name(e);
}

template<>
struct EnumTraits<AnyAmbiguousAliases> {
constexpr static auto type_table = AnyAmbiguousAliasesTypeTable;
constexpr static auto name = EnumNameAnyAmbiguousAliases;
};

inline EnumTraits<AnyAmbiguousAliases> EnumValTraits(AnyAmbiguousAliases) {
return EnumTraits<AnyAmbiguousAliases>{};
}

inline const char *GetEnumName(AnyAmbiguousAliases e) {
return EnumValTraits(e).name(e);
}

inline const MyGame::Example::Monster *GetMonster(const void *buf) {
return ::flatbuffers::GetRoot<MyGame::Example::Monster>(buf);
}
Expand Down
16 changes: 16 additions & 0 deletions tests/cpp17/generated_cpp17/optional_scalars_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ struct ScalarStuff;
struct ScalarStuffBuilder;
struct ScalarStuffT;

template<typename T> struct EnumTraits;

inline const ::flatbuffers::TypeTable *ScalarStuffTypeTable();

enum class OptionalByte : int8_t {
Expand Down Expand Up @@ -928,6 +930,20 @@ inline const ::flatbuffers::TypeTable *ScalarStuffTypeTable() {
return &tt;
}

template<>
struct EnumTraits<OptionalByte> {
constexpr static auto type_table = OptionalByteTypeTable;
constexpr static auto name = EnumNameOptionalByte;
};

inline EnumTraits<OptionalByte> EnumValTraits(OptionalByte) {
return EnumTraits<OptionalByte>{};
}

inline const char *GetEnumName(OptionalByte e) {
return EnumValTraits(e).name(e);
}

inline const optional_scalars::ScalarStuff *GetScalarStuff(const void *buf) {
return ::flatbuffers::GetRoot<optional_scalars::ScalarStuff>(buf);
}
Expand Down
30 changes: 30 additions & 0 deletions tests/cpp17/generated_cpp17/union_vector_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ struct Movie;
struct MovieBuilder;
struct MovieT;

template<typename T> struct EnumTraits;

inline const ::flatbuffers::TypeTable *AttackerTypeTable();

inline const ::flatbuffers::TypeTable *RapunzelTypeTable();
Expand Down Expand Up @@ -1196,6 +1198,34 @@ inline const ::flatbuffers::TypeTable *MovieTypeTable() {
return &tt;
}

template<>
struct EnumTraits<Character> {
constexpr static auto type_table = CharacterTypeTable;
constexpr static auto name = EnumNameCharacter;
};

inline EnumTraits<Character> EnumValTraits(Character) {
return EnumTraits<Character>{};
}

inline const char *GetEnumName(Character e) {
return EnumValTraits(e).name(e);
}

template<>
struct EnumTraits<Gadget> {
constexpr static auto type_table = GadgetTypeTable;
constexpr static auto name = EnumNameGadget;
};

inline EnumTraits<Gadget> EnumValTraits(Gadget) {
return EnumTraits<Gadget>{};
}

inline const char *GetEnumName(Gadget e) {
return EnumValTraits(e).name(e);
}

inline const Movie *GetMovie(const void *buf) {
return ::flatbuffers::GetRoot<Movie>(buf);
}
Expand Down

0 comments on commit 4405b95

Please sign in to comment.