mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 00:38:51 +00:00
emit global scoped ::flatbuffers in c++ (#7764)
This commit is contained in:
@@ -27,9 +27,9 @@ bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs);
|
||||
bool operator==(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
|
||||
bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
|
||||
|
||||
inline const flatbuffers::TypeTable *TableInNestedNSTypeTable();
|
||||
inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable();
|
||||
|
||||
inline const flatbuffers::TypeTable *StructInNestedNSTypeTable();
|
||||
inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable();
|
||||
|
||||
enum UnionInNestedNS : uint8_t {
|
||||
UnionInNestedNS_NONE = 0,
|
||||
@@ -56,7 +56,7 @@ inline const char * const *EnumNamesUnionInNestedNS() {
|
||||
}
|
||||
|
||||
inline const char *EnumNameUnionInNestedNS(UnionInNestedNS e) {
|
||||
if (flatbuffers::IsOutRange(e, UnionInNestedNS_NONE, UnionInNestedNS_TableInNestedNS)) return "";
|
||||
if (::flatbuffers::IsOutRange(e, UnionInNestedNS_NONE, UnionInNestedNS_TableInNestedNS)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesUnionInNestedNS()[index];
|
||||
}
|
||||
@@ -104,8 +104,8 @@ struct UnionInNestedNSUnion {
|
||||
}
|
||||
}
|
||||
|
||||
static void *UnPack(const void *obj, UnionInNestedNS type, const flatbuffers::resolver_function_t *resolver);
|
||||
flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
|
||||
static void *UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver);
|
||||
::flatbuffers::Offset<void> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
|
||||
|
||||
NamespaceA::NamespaceB::TableInNestedNST *AsTableInNestedNS() {
|
||||
return type == UnionInNestedNS_TableInNestedNS ?
|
||||
@@ -138,8 +138,8 @@ inline bool operator!=(const UnionInNestedNSUnion &lhs, const UnionInNestedNSUni
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
bool VerifyUnionInNestedNS(flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type);
|
||||
bool VerifyUnionInNestedNSVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
|
||||
bool VerifyUnionInNestedNS(::flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type);
|
||||
bool VerifyUnionInNestedNSVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types);
|
||||
|
||||
enum EnumInNestedNS : int8_t {
|
||||
EnumInNestedNS_A = 0,
|
||||
@@ -169,7 +169,7 @@ inline const char * const *EnumNamesEnumInNestedNS() {
|
||||
}
|
||||
|
||||
inline const char *EnumNameEnumInNestedNS(EnumInNestedNS e) {
|
||||
if (flatbuffers::IsOutRange(e, EnumInNestedNS_A, EnumInNestedNS_C)) return "";
|
||||
if (::flatbuffers::IsOutRange(e, EnumInNestedNS_A, EnumInNestedNS_C)) return "";
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEnumInNestedNS()[index];
|
||||
}
|
||||
@@ -180,7 +180,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS
|
||||
int32_t b_;
|
||||
|
||||
public:
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return StructInNestedNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
@@ -191,20 +191,20 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS
|
||||
b_(0) {
|
||||
}
|
||||
StructInNestedNS(int32_t _a, int32_t _b)
|
||||
: a_(flatbuffers::EndianScalar(_a)),
|
||||
b_(flatbuffers::EndianScalar(_b)) {
|
||||
: a_(::flatbuffers::EndianScalar(_a)),
|
||||
b_(::flatbuffers::EndianScalar(_b)) {
|
||||
}
|
||||
int32_t a() const {
|
||||
return flatbuffers::EndianScalar(a_);
|
||||
return ::flatbuffers::EndianScalar(a_);
|
||||
}
|
||||
void mutate_a(int32_t _a) {
|
||||
flatbuffers::WriteScalar(&a_, _a);
|
||||
::flatbuffers::WriteScalar(&a_, _a);
|
||||
}
|
||||
int32_t b() const {
|
||||
return flatbuffers::EndianScalar(b_);
|
||||
return ::flatbuffers::EndianScalar(b_);
|
||||
}
|
||||
void mutate_b(int32_t _b) {
|
||||
flatbuffers::WriteScalar(&b_, _b);
|
||||
::flatbuffers::WriteScalar(&b_, _b);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(StructInNestedNS, 8);
|
||||
@@ -220,7 +220,7 @@ inline bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs)
|
||||
}
|
||||
|
||||
|
||||
struct TableInNestedNST : public flatbuffers::NativeTable {
|
||||
struct TableInNestedNST : public ::flatbuffers::NativeTable {
|
||||
typedef TableInNestedNS TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "NamespaceA.NamespaceB.TableInNestedNST";
|
||||
@@ -228,10 +228,10 @@ struct TableInNestedNST : public flatbuffers::NativeTable {
|
||||
int32_t foo = 0;
|
||||
};
|
||||
|
||||
struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef TableInNestedNST NativeTableType;
|
||||
typedef TableInNestedNSBuilder Builder;
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TableInNestedNSTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
@@ -246,43 +246,43 @@ struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
bool mutate_foo(int32_t _foo = 0) {
|
||||
return SetField<int32_t>(VT_FOO, _foo, 0);
|
||||
}
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
bool Verify(::flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int32_t>(verifier, VT_FOO, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TableInNestedNST *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInNestedNST *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static flatbuffers::Offset<TableInNestedNS> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
TableInNestedNST *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<TableInNestedNS> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct TableInNestedNSBuilder {
|
||||
typedef TableInNestedNS Table;
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_foo(int32_t foo) {
|
||||
fbb_.AddElement<int32_t>(TableInNestedNS::VT_FOO, foo, 0);
|
||||
}
|
||||
explicit TableInNestedNSBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||
explicit TableInNestedNSBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
flatbuffers::Offset<TableInNestedNS> Finish() {
|
||||
::flatbuffers::Offset<TableInNestedNS> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = flatbuffers::Offset<TableInNestedNS>(end);
|
||||
auto o = ::flatbuffers::Offset<TableInNestedNS>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int32_t foo = 0) {
|
||||
TableInNestedNSBuilder builder_(_fbb);
|
||||
builder_.add_foo(foo);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
::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) {
|
||||
@@ -295,33 +295,33 @@ inline bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs)
|
||||
}
|
||||
|
||||
|
||||
inline TableInNestedNST *TableInNestedNS::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
inline TableInNestedNST *TableInNestedNS::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::unique_ptr<TableInNestedNST>(new TableInNestedNST());
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void TableInNestedNS::UnPackTo(TableInNestedNST *_o, const flatbuffers::resolver_function_t *_resolver) const {
|
||||
inline void TableInNestedNS::UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = foo(); _o->foo = _e; }
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<TableInNestedNS> TableInNestedNS::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> TableInNestedNS::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return CreateTableInNestedNS(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||
inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TableInNestedNST* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInNestedNST* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _foo = _o->foo;
|
||||
return NamespaceA::NamespaceB::CreateTableInNestedNS(
|
||||
_fbb,
|
||||
_foo);
|
||||
}
|
||||
|
||||
inline bool VerifyUnionInNestedNS(flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type) {
|
||||
inline bool VerifyUnionInNestedNS(::flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type) {
|
||||
switch (type) {
|
||||
case UnionInNestedNS_NONE: {
|
||||
return true;
|
||||
@@ -334,10 +334,10 @@ inline bool VerifyUnionInNestedNS(flatbuffers::Verifier &verifier, const void *o
|
||||
}
|
||||
}
|
||||
|
||||
inline bool VerifyUnionInNestedNSVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
|
||||
inline bool VerifyUnionInNestedNSVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types) {
|
||||
if (!values || !types) return !values && !types;
|
||||
if (values->size() != types->size()) return false;
|
||||
for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
|
||||
for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
|
||||
if (!VerifyUnionInNestedNS(
|
||||
verifier, values->Get(i), types->GetEnum<UnionInNestedNS>(i))) {
|
||||
return false;
|
||||
@@ -346,7 +346,7 @@ inline bool VerifyUnionInNestedNSVector(flatbuffers::Verifier &verifier, const f
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type, const flatbuffers::resolver_function_t *resolver) {
|
||||
inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver) {
|
||||
(void)resolver;
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
@@ -357,7 +357,7 @@ inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type,
|
||||
}
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<void> UnionInNestedNSUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
|
||||
inline ::flatbuffers::Offset<void> UnionInNestedNSUnion::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher) const {
|
||||
(void)_rehasher;
|
||||
switch (type) {
|
||||
case UnionInNestedNS_TableInNestedNS: {
|
||||
@@ -392,31 +392,31 @@ inline void UnionInNestedNSUnion::Reset() {
|
||||
type = UnionInNestedNS_NONE;
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable *UnionInNestedNSTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||
{ flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
inline const ::flatbuffers::TypeTable *UnionInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::TableInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"NONE",
|
||||
"TableInNestedNS"
|
||||
};
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_UNION, 2, type_codes, type_refs, nullptr, nullptr, names
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_UNION, 2, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable *EnumInNestedNSTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ flatbuffers::ET_CHAR, 0, 0 }
|
||||
inline const ::flatbuffers::TypeTable *EnumInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ ::flatbuffers::ET_CHAR, 0, 0 }
|
||||
};
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
NamespaceA::NamespaceB::EnumInNestedNSTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
@@ -424,37 +424,37 @@ inline const flatbuffers::TypeTable *EnumInNestedNSTypeTable() {
|
||||
"B",
|
||||
"C"
|
||||
};
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable *TableInNestedNSTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_INT, 0, -1 }
|
||||
inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"foo"
|
||||
};
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const flatbuffers::TypeTable *StructInNestedNSTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_INT, 0, -1 },
|
||||
{ flatbuffers::ET_INT, 0, -1 }
|
||||
inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_INT, 0, -1 },
|
||||
{ ::flatbuffers::ET_INT, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 4, 8 };
|
||||
static const char * const names[] = {
|
||||
"a",
|
||||
"b"
|
||||
};
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user