• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // automatically generated by the FlatBuffers compiler, do not modify
2 
3 
4 #ifndef FLATBUFFERS_GENERATED_ARRAYSTEST_MYGAME_EXAMPLE_H_
5 #define FLATBUFFERS_GENERATED_ARRAYSTEST_MYGAME_EXAMPLE_H_
6 
7 #include "flatbuffers/flatbuffers.h"
8 
9 namespace MyGame {
10 namespace Example {
11 
12 struct NestedStruct;
13 
14 struct ArrayStruct;
15 
16 struct ArrayTable;
17 struct ArrayTableBuilder;
18 struct ArrayTableT;
19 
20 bool operator==(const NestedStruct &lhs, const NestedStruct &rhs);
21 bool operator!=(const NestedStruct &lhs, const NestedStruct &rhs);
22 bool operator==(const ArrayStruct &lhs, const ArrayStruct &rhs);
23 bool operator!=(const ArrayStruct &lhs, const ArrayStruct &rhs);
24 bool operator==(const ArrayTableT &lhs, const ArrayTableT &rhs);
25 bool operator!=(const ArrayTableT &lhs, const ArrayTableT &rhs);
26 
27 inline const flatbuffers::TypeTable *NestedStructTypeTable();
28 
29 inline const flatbuffers::TypeTable *ArrayStructTypeTable();
30 
31 inline const flatbuffers::TypeTable *ArrayTableTypeTable();
32 
33 enum class TestEnum : int8_t {
34   A = 0,
35   B = 1,
36   C = 2,
37   MIN = A,
38   MAX = C
39 };
40 
EnumValuesTestEnum()41 inline const TestEnum (&EnumValuesTestEnum())[3] {
42   static const TestEnum values[] = {
43     TestEnum::A,
44     TestEnum::B,
45     TestEnum::C
46   };
47   return values;
48 }
49 
EnumNamesTestEnum()50 inline const char * const *EnumNamesTestEnum() {
51   static const char * const names[4] = {
52     "A",
53     "B",
54     "C",
55     nullptr
56   };
57   return names;
58 }
59 
EnumNameTestEnum(TestEnum e)60 inline const char *EnumNameTestEnum(TestEnum e) {
61   if (flatbuffers::IsOutRange(e, TestEnum::A, TestEnum::C)) return "";
62   const size_t index = static_cast<size_t>(e);
63   return EnumNamesTestEnum()[index];
64 }
65 
66 FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) NestedStruct FLATBUFFERS_FINAL_CLASS {
67  private:
68   int32_t a_[2];
69   int8_t b_;
70   int8_t c_[2];
71   int8_t padding0__;  int32_t padding1__;
72   int64_t d_[2];
73 
74  public:
MiniReflectTypeTable()75   static const flatbuffers::TypeTable *MiniReflectTypeTable() {
76     return NestedStructTypeTable();
77   }
NestedStruct()78   NestedStruct()
79       : a_(),
80         b_(0),
81         c_(),
82         padding0__(0),
83         padding1__(0),
84         d_() {
85     (void)padding0__;
86     (void)padding1__;
87   }
NestedStruct(MyGame::Example::TestEnum _b)88   NestedStruct(MyGame::Example::TestEnum _b)
89       : a_(),
90         b_(flatbuffers::EndianScalar(static_cast<int8_t>(_b))),
91         c_(),
92         padding0__(0),
93         padding1__(0),
94         d_() {
95     (void)padding0__;
96     (void)padding1__;
97   }
NestedStruct(flatbuffers::span<const int32_t,2> _a,MyGame::Example::TestEnum _b,flatbuffers::span<const MyGame::Example::TestEnum,2> _c,flatbuffers::span<const int64_t,2> _d)98   NestedStruct(flatbuffers::span<const int32_t, 2> _a, MyGame::Example::TestEnum _b, flatbuffers::span<const MyGame::Example::TestEnum, 2> _c, flatbuffers::span<const int64_t, 2> _d)
99       : b_(flatbuffers::EndianScalar(static_cast<int8_t>(_b))),
100         padding0__(0),
101         padding1__(0) {
102     flatbuffers::CastToArray(a_).CopyFromSpan(_a);
103     flatbuffers::CastToArrayOfEnum<MyGame::Example::TestEnum>(c_).CopyFromSpan(_c);
104     (void)padding0__;
105     (void)padding1__;
106     flatbuffers::CastToArray(d_).CopyFromSpan(_d);
107   }
a()108   const flatbuffers::Array<int32_t, 2> *a() const {
109     return &flatbuffers::CastToArray(a_);
110   }
mutable_a()111   flatbuffers::Array<int32_t, 2> *mutable_a() {
112     return &flatbuffers::CastToArray(a_);
113   }
b()114   MyGame::Example::TestEnum b() const {
115     return static_cast<MyGame::Example::TestEnum>(flatbuffers::EndianScalar(b_));
116   }
mutate_b(MyGame::Example::TestEnum _b)117   void mutate_b(MyGame::Example::TestEnum _b) {
118     flatbuffers::WriteScalar(&b_, static_cast<int8_t>(_b));
119   }
c()120   const flatbuffers::Array<MyGame::Example::TestEnum, 2> *c() const {
121     return &flatbuffers::CastToArrayOfEnum<MyGame::Example::TestEnum>(c_);
122   }
mutable_c()123   flatbuffers::Array<MyGame::Example::TestEnum, 2> *mutable_c() {
124     return &flatbuffers::CastToArrayOfEnum<MyGame::Example::TestEnum>(c_);
125   }
d()126   const flatbuffers::Array<int64_t, 2> *d() const {
127     return &flatbuffers::CastToArray(d_);
128   }
mutable_d()129   flatbuffers::Array<int64_t, 2> *mutable_d() {
130     return &flatbuffers::CastToArray(d_);
131   }
132 };
133 FLATBUFFERS_STRUCT_END(NestedStruct, 32);
134 
135 inline bool operator==(const NestedStruct &lhs, const NestedStruct &rhs) {
136   return
137       (lhs.a() == rhs.a()) &&
138       (lhs.b() == rhs.b()) &&
139       (lhs.c() == rhs.c()) &&
140       (lhs.d() == rhs.d());
141 }
142 
143 inline bool operator!=(const NestedStruct &lhs, const NestedStruct &rhs) {
144     return !(lhs == rhs);
145 }
146 
147 
148 FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) ArrayStruct FLATBUFFERS_FINAL_CLASS {
149  private:
150   float a_;
151   int32_t b_[15];
152   int8_t c_;
153   int8_t padding0__;  int16_t padding1__;  int32_t padding2__;
154   MyGame::Example::NestedStruct d_[2];
155   int32_t e_;
156   int32_t padding3__;
157   int64_t f_[2];
158 
159  public:
MiniReflectTypeTable()160   static const flatbuffers::TypeTable *MiniReflectTypeTable() {
161     return ArrayStructTypeTable();
162   }
ArrayStruct()163   ArrayStruct()
164       : a_(0),
165         b_(),
166         c_(0),
167         padding0__(0),
168         padding1__(0),
169         padding2__(0),
170         d_(),
171         e_(0),
172         padding3__(0),
173         f_() {
174     (void)padding0__;
175     (void)padding1__;
176     (void)padding2__;
177     (void)padding3__;
178   }
ArrayStruct(float _a,int8_t _c,int32_t _e)179   ArrayStruct(float _a, int8_t _c, int32_t _e)
180       : a_(flatbuffers::EndianScalar(_a)),
181         b_(),
182         c_(flatbuffers::EndianScalar(_c)),
183         padding0__(0),
184         padding1__(0),
185         padding2__(0),
186         d_(),
187         e_(flatbuffers::EndianScalar(_e)),
188         padding3__(0),
189         f_() {
190     (void)padding0__;
191     (void)padding1__;
192     (void)padding2__;
193     (void)padding3__;
194   }
ArrayStruct(float _a,flatbuffers::span<const int32_t,15> _b,int8_t _c,flatbuffers::span<const MyGame::Example::NestedStruct,2> _d,int32_t _e,flatbuffers::span<const int64_t,2> _f)195   ArrayStruct(float _a, flatbuffers::span<const int32_t, 15> _b, int8_t _c, flatbuffers::span<const MyGame::Example::NestedStruct, 2> _d, int32_t _e, flatbuffers::span<const int64_t, 2> _f)
196       : a_(flatbuffers::EndianScalar(_a)),
197         c_(flatbuffers::EndianScalar(_c)),
198         padding0__(0),
199         padding1__(0),
200         padding2__(0),
201         e_(flatbuffers::EndianScalar(_e)),
202         padding3__(0) {
203     flatbuffers::CastToArray(b_).CopyFromSpan(_b);
204     (void)padding0__;
205     (void)padding1__;
206     (void)padding2__;
207     flatbuffers::CastToArray(d_).CopyFromSpan(_d);
208     (void)padding3__;
209     flatbuffers::CastToArray(f_).CopyFromSpan(_f);
210   }
a()211   float a() const {
212     return flatbuffers::EndianScalar(a_);
213   }
mutate_a(float _a)214   void mutate_a(float _a) {
215     flatbuffers::WriteScalar(&a_, _a);
216   }
b()217   const flatbuffers::Array<int32_t, 15> *b() const {
218     return &flatbuffers::CastToArray(b_);
219   }
mutable_b()220   flatbuffers::Array<int32_t, 15> *mutable_b() {
221     return &flatbuffers::CastToArray(b_);
222   }
c()223   int8_t c() const {
224     return flatbuffers::EndianScalar(c_);
225   }
mutate_c(int8_t _c)226   void mutate_c(int8_t _c) {
227     flatbuffers::WriteScalar(&c_, _c);
228   }
d()229   const flatbuffers::Array<MyGame::Example::NestedStruct, 2> *d() const {
230     return &flatbuffers::CastToArray(d_);
231   }
mutable_d()232   flatbuffers::Array<MyGame::Example::NestedStruct, 2> *mutable_d() {
233     return &flatbuffers::CastToArray(d_);
234   }
e()235   int32_t e() const {
236     return flatbuffers::EndianScalar(e_);
237   }
mutate_e(int32_t _e)238   void mutate_e(int32_t _e) {
239     flatbuffers::WriteScalar(&e_, _e);
240   }
f()241   const flatbuffers::Array<int64_t, 2> *f() const {
242     return &flatbuffers::CastToArray(f_);
243   }
mutable_f()244   flatbuffers::Array<int64_t, 2> *mutable_f() {
245     return &flatbuffers::CastToArray(f_);
246   }
247 };
248 FLATBUFFERS_STRUCT_END(ArrayStruct, 160);
249 
250 inline bool operator==(const ArrayStruct &lhs, const ArrayStruct &rhs) {
251   return
252       (lhs.a() == rhs.a()) &&
253       (lhs.b() == rhs.b()) &&
254       (lhs.c() == rhs.c()) &&
255       (lhs.d() == rhs.d()) &&
256       (lhs.e() == rhs.e()) &&
257       (lhs.f() == rhs.f());
258 }
259 
260 inline bool operator!=(const ArrayStruct &lhs, const ArrayStruct &rhs) {
261     return !(lhs == rhs);
262 }
263 
264 
265 struct ArrayTableT : public flatbuffers::NativeTable {
266   typedef ArrayTable TableType;
267   flatbuffers::unique_ptr<MyGame::Example::ArrayStruct> a{};
268 };
269 
270 inline bool operator==(const ArrayTableT &lhs, const ArrayTableT &rhs) {
271   return
272       (lhs.a == rhs.a);
273 }
274 
275 inline bool operator!=(const ArrayTableT &lhs, const ArrayTableT &rhs) {
276     return !(lhs == rhs);
277 }
278 
279 
280 struct ArrayTable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
281   typedef ArrayTableT NativeTableType;
282   typedef ArrayTableBuilder Builder;
MiniReflectTypeTableFLATBUFFERS_FINAL_CLASS283   static const flatbuffers::TypeTable *MiniReflectTypeTable() {
284     return ArrayTableTypeTable();
285   }
286   enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
287     VT_A = 4
288   };
aFLATBUFFERS_FINAL_CLASS289   const MyGame::Example::ArrayStruct *a() const {
290     return GetStruct<const MyGame::Example::ArrayStruct *>(VT_A);
291   }
mutable_aFLATBUFFERS_FINAL_CLASS292   MyGame::Example::ArrayStruct *mutable_a() {
293     return GetStruct<MyGame::Example::ArrayStruct *>(VT_A);
294   }
VerifyFLATBUFFERS_FINAL_CLASS295   bool Verify(flatbuffers::Verifier &verifier) const {
296     return VerifyTableStart(verifier) &&
297            VerifyField<MyGame::Example::ArrayStruct>(verifier, VT_A) &&
298            verifier.EndTable();
299   }
300   ArrayTableT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
301   void UnPackTo(ArrayTableT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
302   static flatbuffers::Offset<ArrayTable> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ArrayTableT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
303 };
304 
305 struct ArrayTableBuilder {
306   typedef ArrayTable Table;
307   flatbuffers::FlatBufferBuilder &fbb_;
308   flatbuffers::uoffset_t start_;
add_aArrayTableBuilder309   void add_a(const MyGame::Example::ArrayStruct *a) {
310     fbb_.AddStruct(ArrayTable::VT_A, a);
311   }
ArrayTableBuilderArrayTableBuilder312   explicit ArrayTableBuilder(flatbuffers::FlatBufferBuilder &_fbb)
313         : fbb_(_fbb) {
314     start_ = fbb_.StartTable();
315   }
FinishArrayTableBuilder316   flatbuffers::Offset<ArrayTable> Finish() {
317     const auto end = fbb_.EndTable(start_);
318     auto o = flatbuffers::Offset<ArrayTable>(end);
319     return o;
320   }
321 };
322 
323 inline flatbuffers::Offset<ArrayTable> CreateArrayTable(
324     flatbuffers::FlatBufferBuilder &_fbb,
325     const MyGame::Example::ArrayStruct *a = 0) {
326   ArrayTableBuilder builder_(_fbb);
327   builder_.add_a(a);
328   return builder_.Finish();
329 }
330 
331 flatbuffers::Offset<ArrayTable> CreateArrayTable(flatbuffers::FlatBufferBuilder &_fbb, const ArrayTableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
332 
UnPack(const flatbuffers::resolver_function_t * _resolver)333 inline ArrayTableT *ArrayTable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
334   auto _o = std::unique_ptr<ArrayTableT>(new ArrayTableT());
335   UnPackTo(_o.get(), _resolver);
336   return _o.release();
337 }
338 
UnPackTo(ArrayTableT * _o,const flatbuffers::resolver_function_t * _resolver)339 inline void ArrayTable::UnPackTo(ArrayTableT *_o, const flatbuffers::resolver_function_t *_resolver) const {
340   (void)_o;
341   (void)_resolver;
342   { auto _e = a(); if (_e) _o->a = flatbuffers::unique_ptr<MyGame::Example::ArrayStruct>(new MyGame::Example::ArrayStruct(*_e)); }
343 }
344 
Pack(flatbuffers::FlatBufferBuilder & _fbb,const ArrayTableT * _o,const flatbuffers::rehasher_function_t * _rehasher)345 inline flatbuffers::Offset<ArrayTable> ArrayTable::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ArrayTableT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
346   return CreateArrayTable(_fbb, _o, _rehasher);
347 }
348 
CreateArrayTable(flatbuffers::FlatBufferBuilder & _fbb,const ArrayTableT * _o,const flatbuffers::rehasher_function_t * _rehasher)349 inline flatbuffers::Offset<ArrayTable> CreateArrayTable(flatbuffers::FlatBufferBuilder &_fbb, const ArrayTableT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
350   (void)_rehasher;
351   (void)_o;
352   struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ArrayTableT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
353   auto _a = _o->a ? _o->a.get() : 0;
354   return MyGame::Example::CreateArrayTable(
355       _fbb,
356       _a);
357 }
358 
TestEnumTypeTable()359 inline const flatbuffers::TypeTable *TestEnumTypeTable() {
360   static const flatbuffers::TypeCode type_codes[] = {
361     { flatbuffers::ET_CHAR, 0, 0 },
362     { flatbuffers::ET_CHAR, 0, 0 },
363     { flatbuffers::ET_CHAR, 0, 0 }
364   };
365   static const flatbuffers::TypeFunction type_refs[] = {
366     MyGame::Example::TestEnumTypeTable
367   };
368   static const char * const names[] = {
369     "A",
370     "B",
371     "C"
372   };
373   static const flatbuffers::TypeTable tt = {
374     flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
375   };
376   return &tt;
377 }
378 
NestedStructTypeTable()379 inline const flatbuffers::TypeTable *NestedStructTypeTable() {
380   static const flatbuffers::TypeCode type_codes[] = {
381     { flatbuffers::ET_INT, 1, -1 },
382     { flatbuffers::ET_CHAR, 0, 0 },
383     { flatbuffers::ET_CHAR, 1, 0 },
384     { flatbuffers::ET_LONG, 1, -1 }
385   };
386   static const flatbuffers::TypeFunction type_refs[] = {
387     MyGame::Example::TestEnumTypeTable
388   };
389   static const int16_t array_sizes[] = { 2, 2, 2,  };
390   static const int64_t values[] = { 0, 8, 9, 16, 32 };
391   static const char * const names[] = {
392     "a",
393     "b",
394     "c",
395     "d"
396   };
397   static const flatbuffers::TypeTable tt = {
398     flatbuffers::ST_STRUCT, 4, type_codes, type_refs, array_sizes, values, names
399   };
400   return &tt;
401 }
402 
ArrayStructTypeTable()403 inline const flatbuffers::TypeTable *ArrayStructTypeTable() {
404   static const flatbuffers::TypeCode type_codes[] = {
405     { flatbuffers::ET_FLOAT, 0, -1 },
406     { flatbuffers::ET_INT, 1, -1 },
407     { flatbuffers::ET_CHAR, 0, -1 },
408     { flatbuffers::ET_SEQUENCE, 1, 0 },
409     { flatbuffers::ET_INT, 0, -1 },
410     { flatbuffers::ET_LONG, 1, -1 }
411   };
412   static const flatbuffers::TypeFunction type_refs[] = {
413     MyGame::Example::NestedStructTypeTable
414   };
415   static const int16_t array_sizes[] = { 15, 2, 2,  };
416   static const int64_t values[] = { 0, 4, 64, 72, 136, 144, 160 };
417   static const char * const names[] = {
418     "a",
419     "b",
420     "c",
421     "d",
422     "e",
423     "f"
424   };
425   static const flatbuffers::TypeTable tt = {
426     flatbuffers::ST_STRUCT, 6, type_codes, type_refs, array_sizes, values, names
427   };
428   return &tt;
429 }
430 
ArrayTableTypeTable()431 inline const flatbuffers::TypeTable *ArrayTableTypeTable() {
432   static const flatbuffers::TypeCode type_codes[] = {
433     { flatbuffers::ET_SEQUENCE, 0, 0 }
434   };
435   static const flatbuffers::TypeFunction type_refs[] = {
436     MyGame::Example::ArrayStructTypeTable
437   };
438   static const char * const names[] = {
439     "a"
440   };
441   static const flatbuffers::TypeTable tt = {
442     flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
443   };
444   return &tt;
445 }
446 
GetArrayTable(const void * buf)447 inline const MyGame::Example::ArrayTable *GetArrayTable(const void *buf) {
448   return flatbuffers::GetRoot<MyGame::Example::ArrayTable>(buf);
449 }
450 
GetSizePrefixedArrayTable(const void * buf)451 inline const MyGame::Example::ArrayTable *GetSizePrefixedArrayTable(const void *buf) {
452   return flatbuffers::GetSizePrefixedRoot<MyGame::Example::ArrayTable>(buf);
453 }
454 
GetMutableArrayTable(void * buf)455 inline ArrayTable *GetMutableArrayTable(void *buf) {
456   return flatbuffers::GetMutableRoot<ArrayTable>(buf);
457 }
458 
ArrayTableIdentifier()459 inline const char *ArrayTableIdentifier() {
460   return "ARRT";
461 }
462 
ArrayTableBufferHasIdentifier(const void * buf)463 inline bool ArrayTableBufferHasIdentifier(const void *buf) {
464   return flatbuffers::BufferHasIdentifier(
465       buf, ArrayTableIdentifier());
466 }
467 
VerifyArrayTableBuffer(flatbuffers::Verifier & verifier)468 inline bool VerifyArrayTableBuffer(
469     flatbuffers::Verifier &verifier) {
470   return verifier.VerifyBuffer<MyGame::Example::ArrayTable>(ArrayTableIdentifier());
471 }
472 
VerifySizePrefixedArrayTableBuffer(flatbuffers::Verifier & verifier)473 inline bool VerifySizePrefixedArrayTableBuffer(
474     flatbuffers::Verifier &verifier) {
475   return verifier.VerifySizePrefixedBuffer<MyGame::Example::ArrayTable>(ArrayTableIdentifier());
476 }
477 
ArrayTableExtension()478 inline const char *ArrayTableExtension() {
479   return "mon";
480 }
481 
FinishArrayTableBuffer(flatbuffers::FlatBufferBuilder & fbb,flatbuffers::Offset<MyGame::Example::ArrayTable> root)482 inline void FinishArrayTableBuffer(
483     flatbuffers::FlatBufferBuilder &fbb,
484     flatbuffers::Offset<MyGame::Example::ArrayTable> root) {
485   fbb.Finish(root, ArrayTableIdentifier());
486 }
487 
FinishSizePrefixedArrayTableBuffer(flatbuffers::FlatBufferBuilder & fbb,flatbuffers::Offset<MyGame::Example::ArrayTable> root)488 inline void FinishSizePrefixedArrayTableBuffer(
489     flatbuffers::FlatBufferBuilder &fbb,
490     flatbuffers::Offset<MyGame::Example::ArrayTable> root) {
491   fbb.FinishSizePrefixed(root, ArrayTableIdentifier());
492 }
493 
494 inline flatbuffers::unique_ptr<MyGame::Example::ArrayTableT> UnPackArrayTable(
495     const void *buf,
496     const flatbuffers::resolver_function_t *res = nullptr) {
497   return flatbuffers::unique_ptr<MyGame::Example::ArrayTableT>(GetArrayTable(buf)->UnPack(res));
498 }
499 
500 inline flatbuffers::unique_ptr<MyGame::Example::ArrayTableT> UnPackSizePrefixedArrayTable(
501     const void *buf,
502     const flatbuffers::resolver_function_t *res = nullptr) {
503   return flatbuffers::unique_ptr<MyGame::Example::ArrayTableT>(GetSizePrefixedArrayTable(buf)->UnPack(res));
504 }
505 
506 }  // namespace Example
507 }  // namespace MyGame
508 
509 #endif  // FLATBUFFERS_GENERATED_ARRAYSTEST_MYGAME_EXAMPLE_H_
510