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