...

Text file src/github.com/google/flatbuffers/tests/namespace_test/namespace_test1_generated.h

Documentation: github.com/google/flatbuffers/tests/namespace_test

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3
     4#ifndef FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
     5#define FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_
     6
     7#include "flatbuffers/flatbuffers.h"
     8
     9// Ensure the included flatbuffers.h is the same version as when this file was
    10// generated, otherwise it may not be compatible.
    11static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
    12              FLATBUFFERS_VERSION_MINOR == 5 &&
    13              FLATBUFFERS_VERSION_REVISION == 26,
    14             "Non-compatible flatbuffers version included");
    15
    16namespace NamespaceA {
    17namespace NamespaceB {
    18
    19struct TableInNestedNS;
    20struct TableInNestedNSBuilder;
    21struct TableInNestedNST;
    22
    23struct StructInNestedNS;
    24
    25bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs);
    26bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs);
    27bool operator==(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
    28bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs);
    29
    30inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable();
    31
    32inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable();
    33
    34enum UnionInNestedNS : uint8_t {
    35  UnionInNestedNS_NONE = 0,
    36  UnionInNestedNS_TableInNestedNS = 1,
    37  UnionInNestedNS_MIN = UnionInNestedNS_NONE,
    38  UnionInNestedNS_MAX = UnionInNestedNS_TableInNestedNS
    39};
    40
    41inline const UnionInNestedNS (&EnumValuesUnionInNestedNS())[2] {
    42  static const UnionInNestedNS values[] = {
    43    UnionInNestedNS_NONE,
    44    UnionInNestedNS_TableInNestedNS
    45  };
    46  return values;
    47}
    48
    49inline const char * const *EnumNamesUnionInNestedNS() {
    50  static const char * const names[3] = {
    51    "NONE",
    52    "TableInNestedNS",
    53    nullptr
    54  };
    55  return names;
    56}
    57
    58inline const char *EnumNameUnionInNestedNS(UnionInNestedNS e) {
    59  if (::flatbuffers::IsOutRange(e, UnionInNestedNS_NONE, UnionInNestedNS_TableInNestedNS)) return "";
    60  const size_t index = static_cast<size_t>(e);
    61  return EnumNamesUnionInNestedNS()[index];
    62}
    63
    64template<typename T> struct UnionInNestedNSTraits {
    65  static const UnionInNestedNS enum_value = UnionInNestedNS_NONE;
    66};
    67
    68template<> struct UnionInNestedNSTraits<NamespaceA::NamespaceB::TableInNestedNS> {
    69  static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
    70};
    71
    72template<typename T> struct UnionInNestedNSUnionTraits {
    73  static const UnionInNestedNS enum_value = UnionInNestedNS_NONE;
    74};
    75
    76template<> struct UnionInNestedNSUnionTraits<NamespaceA::NamespaceB::TableInNestedNST> {
    77  static const UnionInNestedNS enum_value = UnionInNestedNS_TableInNestedNS;
    78};
    79
    80struct UnionInNestedNSUnion {
    81  UnionInNestedNS type;
    82  void *value;
    83
    84  UnionInNestedNSUnion() : type(UnionInNestedNS_NONE), value(nullptr) {}
    85  UnionInNestedNSUnion(UnionInNestedNSUnion&& u) FLATBUFFERS_NOEXCEPT :
    86    type(UnionInNestedNS_NONE), value(nullptr)
    87    { std::swap(type, u.type); std::swap(value, u.value); }
    88  UnionInNestedNSUnion(const UnionInNestedNSUnion &);
    89  UnionInNestedNSUnion &operator=(const UnionInNestedNSUnion &u)
    90    { UnionInNestedNSUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
    91  UnionInNestedNSUnion &operator=(UnionInNestedNSUnion &&u) FLATBUFFERS_NOEXCEPT
    92    { std::swap(type, u.type); std::swap(value, u.value); return *this; }
    93  ~UnionInNestedNSUnion() { Reset(); }
    94
    95  void Reset();
    96
    97  template <typename T>
    98  void Set(T&& val) {
    99    typedef typename std::remove_reference<T>::type RT;
   100    Reset();
   101    type = UnionInNestedNSUnionTraits<RT>::enum_value;
   102    if (type != UnionInNestedNS_NONE) {
   103      value = new RT(std::forward<T>(val));
   104    }
   105  }
   106
   107  static void *UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver);
   108  ::flatbuffers::Offset<void> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
   109
   110  NamespaceA::NamespaceB::TableInNestedNST *AsTableInNestedNS() {
   111    return type == UnionInNestedNS_TableInNestedNS ?
   112      reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(value) : nullptr;
   113  }
   114  const NamespaceA::NamespaceB::TableInNestedNST *AsTableInNestedNS() const {
   115    return type == UnionInNestedNS_TableInNestedNS ?
   116      reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value) : nullptr;
   117  }
   118};
   119
   120
   121inline bool operator==(const UnionInNestedNSUnion &lhs, const UnionInNestedNSUnion &rhs) {
   122  if (lhs.type != rhs.type) return false;
   123  switch (lhs.type) {
   124    case UnionInNestedNS_NONE: {
   125      return true;
   126    }
   127    case UnionInNestedNS_TableInNestedNS: {
   128      return *(reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(lhs.value)) ==
   129             *(reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(rhs.value));
   130    }
   131    default: {
   132      return false;
   133    }
   134  }
   135}
   136
   137inline bool operator!=(const UnionInNestedNSUnion &lhs, const UnionInNestedNSUnion &rhs) {
   138    return !(lhs == rhs);
   139}
   140
   141bool VerifyUnionInNestedNS(::flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type);
   142bool VerifyUnionInNestedNSVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types);
   143
   144enum EnumInNestedNS : int8_t {
   145  EnumInNestedNS_A = 0,
   146  EnumInNestedNS_B = 1,
   147  EnumInNestedNS_C = 2,
   148  EnumInNestedNS_MIN = EnumInNestedNS_A,
   149  EnumInNestedNS_MAX = EnumInNestedNS_C
   150};
   151
   152inline const EnumInNestedNS (&EnumValuesEnumInNestedNS())[3] {
   153  static const EnumInNestedNS values[] = {
   154    EnumInNestedNS_A,
   155    EnumInNestedNS_B,
   156    EnumInNestedNS_C
   157  };
   158  return values;
   159}
   160
   161inline const char * const *EnumNamesEnumInNestedNS() {
   162  static const char * const names[4] = {
   163    "A",
   164    "B",
   165    "C",
   166    nullptr
   167  };
   168  return names;
   169}
   170
   171inline const char *EnumNameEnumInNestedNS(EnumInNestedNS e) {
   172  if (::flatbuffers::IsOutRange(e, EnumInNestedNS_A, EnumInNestedNS_C)) return "";
   173  const size_t index = static_cast<size_t>(e);
   174  return EnumNamesEnumInNestedNS()[index];
   175}
   176
   177FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS {
   178 private:
   179  int32_t a_;
   180  int32_t b_;
   181
   182 public:
   183  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   184    return StructInNestedNSTypeTable();
   185  }
   186  static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
   187    return "NamespaceA.NamespaceB.StructInNestedNS";
   188  }
   189  StructInNestedNS()
   190      : a_(0),
   191        b_(0) {
   192  }
   193  StructInNestedNS(int32_t _a, int32_t _b)
   194      : a_(::flatbuffers::EndianScalar(_a)),
   195        b_(::flatbuffers::EndianScalar(_b)) {
   196  }
   197  int32_t a() const {
   198    return ::flatbuffers::EndianScalar(a_);
   199  }
   200  void mutate_a(int32_t _a) {
   201    ::flatbuffers::WriteScalar(&a_, _a);
   202  }
   203  int32_t b() const {
   204    return ::flatbuffers::EndianScalar(b_);
   205  }
   206  void mutate_b(int32_t _b) {
   207    ::flatbuffers::WriteScalar(&b_, _b);
   208  }
   209};
   210FLATBUFFERS_STRUCT_END(StructInNestedNS, 8);
   211
   212inline bool operator==(const StructInNestedNS &lhs, const StructInNestedNS &rhs) {
   213  return
   214      (lhs.a() == rhs.a()) &&
   215      (lhs.b() == rhs.b());
   216}
   217
   218inline bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs) {
   219    return !(lhs == rhs);
   220}
   221
   222
   223struct TableInNestedNST : public ::flatbuffers::NativeTable {
   224  typedef TableInNestedNS TableType;
   225  static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
   226    return "NamespaceA.NamespaceB.TableInNestedNST";
   227  }
   228  int32_t foo = 0;
   229};
   230
   231struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
   232  typedef TableInNestedNST NativeTableType;
   233  typedef TableInNestedNSBuilder Builder;
   234  static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
   235    return TableInNestedNSTypeTable();
   236  }
   237  static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
   238    return "NamespaceA.NamespaceB.TableInNestedNS";
   239  }
   240  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
   241    VT_FOO = 4
   242  };
   243  int32_t foo() const {
   244    return GetField<int32_t>(VT_FOO, 0);
   245  }
   246  bool mutate_foo(int32_t _foo = 0) {
   247    return SetField<int32_t>(VT_FOO, _foo, 0);
   248  }
   249  bool Verify(::flatbuffers::Verifier &verifier) const {
   250    return VerifyTableStart(verifier) &&
   251           VerifyField<int32_t>(verifier, VT_FOO, 4) &&
   252           verifier.EndTable();
   253  }
   254  TableInNestedNST *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
   255  void UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
   256  static ::flatbuffers::Offset<TableInNestedNS> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
   257};
   258
   259struct TableInNestedNSBuilder {
   260  typedef TableInNestedNS Table;
   261  ::flatbuffers::FlatBufferBuilder &fbb_;
   262  ::flatbuffers::uoffset_t start_;
   263  void add_foo(int32_t foo) {
   264    fbb_.AddElement<int32_t>(TableInNestedNS::VT_FOO, foo, 0);
   265  }
   266  explicit TableInNestedNSBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
   267        : fbb_(_fbb) {
   268    start_ = fbb_.StartTable();
   269  }
   270  ::flatbuffers::Offset<TableInNestedNS> Finish() {
   271    const auto end = fbb_.EndTable(start_);
   272    auto o = ::flatbuffers::Offset<TableInNestedNS>(end);
   273    return o;
   274  }
   275};
   276
   277inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(
   278    ::flatbuffers::FlatBufferBuilder &_fbb,
   279    int32_t foo = 0) {
   280  TableInNestedNSBuilder builder_(_fbb);
   281  builder_.add_foo(foo);
   282  return builder_.Finish();
   283}
   284
   285::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
   286
   287
   288inline bool operator==(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
   289  return
   290      (lhs.foo == rhs.foo);
   291}
   292
   293inline bool operator!=(const TableInNestedNST &lhs, const TableInNestedNST &rhs) {
   294    return !(lhs == rhs);
   295}
   296
   297
   298inline TableInNestedNST *TableInNestedNS::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
   299  auto _o = std::unique_ptr<TableInNestedNST>(new TableInNestedNST());
   300  UnPackTo(_o.get(), _resolver);
   301  return _o.release();
   302}
   303
   304inline void TableInNestedNS::UnPackTo(TableInNestedNST *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
   305  (void)_o;
   306  (void)_resolver;
   307  { auto _e = foo(); _o->foo = _e; }
   308}
   309
   310inline ::flatbuffers::Offset<TableInNestedNS> TableInNestedNS::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
   311  return CreateTableInNestedNS(_fbb, _o, _rehasher);
   312}
   313
   314inline ::flatbuffers::Offset<TableInNestedNS> CreateTableInNestedNS(::flatbuffers::FlatBufferBuilder &_fbb, const TableInNestedNST *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
   315  (void)_rehasher;
   316  (void)_o;
   317  struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const TableInNestedNST* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
   318  auto _foo = _o->foo;
   319  return NamespaceA::NamespaceB::CreateTableInNestedNS(
   320      _fbb,
   321      _foo);
   322}
   323
   324inline bool VerifyUnionInNestedNS(::flatbuffers::Verifier &verifier, const void *obj, UnionInNestedNS type) {
   325  switch (type) {
   326    case UnionInNestedNS_NONE: {
   327      return true;
   328    }
   329    case UnionInNestedNS_TableInNestedNS: {
   330      auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
   331      return verifier.VerifyTable(ptr);
   332    }
   333    default: return true;
   334  }
   335}
   336
   337inline bool VerifyUnionInNestedNSVector(::flatbuffers::Verifier &verifier, const ::flatbuffers::Vector<::flatbuffers::Offset<void>> *values, const ::flatbuffers::Vector<uint8_t> *types) {
   338  if (!values || !types) return !values && !types;
   339  if (values->size() != types->size()) return false;
   340  for (::flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
   341    if (!VerifyUnionInNestedNS(
   342        verifier,  values->Get(i), types->GetEnum<UnionInNestedNS>(i))) {
   343      return false;
   344    }
   345  }
   346  return true;
   347}
   348
   349inline void *UnionInNestedNSUnion::UnPack(const void *obj, UnionInNestedNS type, const ::flatbuffers::resolver_function_t *resolver) {
   350  (void)resolver;
   351  switch (type) {
   352    case UnionInNestedNS_TableInNestedNS: {
   353      auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNS *>(obj);
   354      return ptr->UnPack(resolver);
   355    }
   356    default: return nullptr;
   357  }
   358}
   359
   360inline ::flatbuffers::Offset<void> UnionInNestedNSUnion::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const ::flatbuffers::rehasher_function_t *_rehasher) const {
   361  (void)_rehasher;
   362  switch (type) {
   363    case UnionInNestedNS_TableInNestedNS: {
   364      auto ptr = reinterpret_cast<const NamespaceA::NamespaceB::TableInNestedNST *>(value);
   365      return CreateTableInNestedNS(_fbb, ptr, _rehasher).Union();
   366    }
   367    default: return 0;
   368  }
   369}
   370
   371inline UnionInNestedNSUnion::UnionInNestedNSUnion(const UnionInNestedNSUnion &u) : type(u.type), value(nullptr) {
   372  switch (type) {
   373    case UnionInNestedNS_TableInNestedNS: {
   374      value = new NamespaceA::NamespaceB::TableInNestedNST(*reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(u.value));
   375      break;
   376    }
   377    default:
   378      break;
   379  }
   380}
   381
   382inline void UnionInNestedNSUnion::Reset() {
   383  switch (type) {
   384    case UnionInNestedNS_TableInNestedNS: {
   385      auto ptr = reinterpret_cast<NamespaceA::NamespaceB::TableInNestedNST *>(value);
   386      delete ptr;
   387      break;
   388    }
   389    default: break;
   390  }
   391  value = nullptr;
   392  type = UnionInNestedNS_NONE;
   393}
   394
   395inline const ::flatbuffers::TypeTable *UnionInNestedNSTypeTable() {
   396  static const ::flatbuffers::TypeCode type_codes[] = {
   397    { ::flatbuffers::ET_SEQUENCE, 0, -1 },
   398    { ::flatbuffers::ET_SEQUENCE, 0, 0 }
   399  };
   400  static const ::flatbuffers::TypeFunction type_refs[] = {
   401    NamespaceA::NamespaceB::TableInNestedNSTypeTable
   402  };
   403  static const char * const names[] = {
   404    "NONE",
   405    "TableInNestedNS"
   406  };
   407  static const ::flatbuffers::TypeTable tt = {
   408    ::flatbuffers::ST_UNION, 2, type_codes, type_refs, nullptr, nullptr, names
   409  };
   410  return &tt;
   411}
   412
   413inline const ::flatbuffers::TypeTable *EnumInNestedNSTypeTable() {
   414  static const ::flatbuffers::TypeCode type_codes[] = {
   415    { ::flatbuffers::ET_CHAR, 0, 0 },
   416    { ::flatbuffers::ET_CHAR, 0, 0 },
   417    { ::flatbuffers::ET_CHAR, 0, 0 }
   418  };
   419  static const ::flatbuffers::TypeFunction type_refs[] = {
   420    NamespaceA::NamespaceB::EnumInNestedNSTypeTable
   421  };
   422  static const char * const names[] = {
   423    "A",
   424    "B",
   425    "C"
   426  };
   427  static const ::flatbuffers::TypeTable tt = {
   428    ::flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
   429  };
   430  return &tt;
   431}
   432
   433inline const ::flatbuffers::TypeTable *TableInNestedNSTypeTable() {
   434  static const ::flatbuffers::TypeCode type_codes[] = {
   435    { ::flatbuffers::ET_INT, 0, -1 }
   436  };
   437  static const char * const names[] = {
   438    "foo"
   439  };
   440  static const ::flatbuffers::TypeTable tt = {
   441    ::flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
   442  };
   443  return &tt;
   444}
   445
   446inline const ::flatbuffers::TypeTable *StructInNestedNSTypeTable() {
   447  static const ::flatbuffers::TypeCode type_codes[] = {
   448    { ::flatbuffers::ET_INT, 0, -1 },
   449    { ::flatbuffers::ET_INT, 0, -1 }
   450  };
   451  static const int64_t values[] = { 0, 4, 8 };
   452  static const char * const names[] = {
   453    "a",
   454    "b"
   455  };
   456  static const ::flatbuffers::TypeTable tt = {
   457    ::flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
   458  };
   459  return &tt;
   460}
   461
   462}  // namespace NamespaceB
   463}  // namespace NamespaceA
   464
   465#endif  // FLATBUFFERS_GENERATED_NAMESPACETEST1_NAMESPACEA_NAMESPACEB_H_

View as plain text