mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-15 16:57:29 +00:00
[C++] Add Builder and Table typedefs (#5685)
* Add Builder and Table typedefs This gives us a way to use templates to go from a builder to a table and back again without having to pass both types in. * Fix tests/cpp17/generated_cpp17/monster_test_generated.h
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
31f8799083
commit
901b89e733
@@ -7,6 +7,7 @@
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
struct Attacker;
|
||||
struct AttackerBuilder;
|
||||
struct AttackerT;
|
||||
|
||||
struct Rapunzel;
|
||||
@@ -14,6 +15,7 @@ struct Rapunzel;
|
||||
struct BookReader;
|
||||
|
||||
struct Movie;
|
||||
struct MovieBuilder;
|
||||
struct MovieT;
|
||||
|
||||
bool operator==(const AttackerT &lhs, const AttackerT &rhs);
|
||||
@@ -278,6 +280,7 @@ inline bool operator!=(const AttackerT &lhs, const AttackerT &rhs) {
|
||||
|
||||
struct Attacker FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef AttackerT NativeTableType;
|
||||
typedef AttackerBuilder Builder;
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AttackerTypeTable();
|
||||
}
|
||||
@@ -301,6 +304,7 @@ struct Attacker FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
};
|
||||
|
||||
struct AttackerBuilder {
|
||||
typedef Attacker Table;
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_sword_attack_damage(int32_t sword_attack_damage) {
|
||||
@@ -349,6 +353,7 @@ inline bool operator!=(const MovieT &lhs, const MovieT &rhs) {
|
||||
|
||||
struct Movie FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef MovieT NativeTableType;
|
||||
typedef MovieBuilder Builder;
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return MovieTypeTable();
|
||||
}
|
||||
@@ -415,6 +420,7 @@ struct Movie FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
};
|
||||
|
||||
struct MovieBuilder {
|
||||
typedef Movie Table;
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_main_character_type(Character main_character_type) {
|
||||
|
||||
Reference in New Issue
Block a user