1 // automatically generated by the FlatBuffers compiler, do not modify
2
3
4 #ifndef FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
5 #define FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
6
7 #include "flatbuffers/flatbuffers.h"
8
9 namespace MyGame {
10 namespace Example2 {
11
12 struct Monster;
13 struct MonsterT;
14
15 } // namespace Example2
16
17 namespace Example {
18
19 struct Test;
20
21 struct TestSimpleTableWithEnum;
22 struct TestSimpleTableWithEnumT;
23
24 struct Vec3;
25
26 struct Stat;
27 struct StatT;
28
29 struct Monster;
30 struct MonsterT;
31
32 enum Color {
33 Color_Red = 1,
34 Color_Green = 2,
35 Color_Blue = 8,
36 Color_NONE = 0,
37 Color_ANY = 11
38 };
39
EnumNamesColor()40 inline const char **EnumNamesColor() {
41 static const char *names[] = {
42 "Red",
43 "Green",
44 "",
45 "",
46 "",
47 "",
48 "",
49 "Blue",
50 nullptr
51 };
52 return names;
53 }
54
EnumNameColor(Color e)55 inline const char *EnumNameColor(Color e) {
56 const size_t index = static_cast<int>(e) - static_cast<int>(Color_Red);
57 return EnumNamesColor()[index];
58 }
59
60 enum Any {
61 Any_NONE = 0,
62 Any_Monster = 1,
63 Any_TestSimpleTableWithEnum = 2,
64 Any_MyGame_Example2_Monster = 3,
65 Any_MIN = Any_NONE,
66 Any_MAX = Any_MyGame_Example2_Monster
67 };
68
EnumNamesAny()69 inline const char **EnumNamesAny() {
70 static const char *names[] = {
71 "NONE",
72 "Monster",
73 "TestSimpleTableWithEnum",
74 "MyGame_Example2_Monster",
75 nullptr
76 };
77 return names;
78 }
79
EnumNameAny(Any e)80 inline const char *EnumNameAny(Any e) {
81 const size_t index = static_cast<int>(e);
82 return EnumNamesAny()[index];
83 }
84
85 template<typename T> struct AnyTraits {
86 static const Any enum_value = Any_NONE;
87 };
88
89 template<> struct AnyTraits<Monster> {
90 static const Any enum_value = Any_Monster;
91 };
92
93 template<> struct AnyTraits<TestSimpleTableWithEnum> {
94 static const Any enum_value = Any_TestSimpleTableWithEnum;
95 };
96
97 template<> struct AnyTraits<MyGame::Example2::Monster> {
98 static const Any enum_value = Any_MyGame_Example2_Monster;
99 };
100
101 struct AnyUnion {
102 Any type;
103 flatbuffers::NativeTable *table;
104
105 AnyUnion() : type(Any_NONE), table(nullptr) {}
106 AnyUnion(AnyUnion&& u):
107 type(std::move(u.type)), table(std::move(u.table)) {}
108 AnyUnion(const AnyUnion &);
109 AnyUnion &operator=(const AnyUnion &);
110 ~AnyUnion() { Reset(); }
111
112 void Reset();
113
114 template <typename T>
115 void Set(T&& value) {
116 Reset();
117 type = AnyTraits<typename T::TableType>::enum_value;
118 if (type != Any_NONE) {
119 table = new T(std::forward<T>(value));
120 }
121 }
122
123 static flatbuffers::NativeTable *UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver);
124 flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
125
126 MonsterT *AsMonster() {
127 return type == Any_Monster ?
128 reinterpret_cast<MonsterT *>(table) : nullptr;
129 }
130 TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() {
131 return type == Any_TestSimpleTableWithEnum ?
132 reinterpret_cast<TestSimpleTableWithEnumT *>(table) : nullptr;
133 }
134 MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() {
135 return type == Any_MyGame_Example2_Monster ?
136 reinterpret_cast<MyGame::Example2::MonsterT *>(table) : nullptr;
137 }
138 };
139
140 bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type);
141 bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
142
143 MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
144 private:
145 int16_t a_;
146 int8_t b_;
147 int8_t padding0__;
148
149 public:
150 Test() {
151 memset(this, 0, sizeof(Test));
152 }
153 Test(const Test &_o) {
154 memcpy(this, &_o, sizeof(Test));
155 }
156 Test(int16_t _a, int8_t _b)
157 : a_(flatbuffers::EndianScalar(_a)),
158 b_(flatbuffers::EndianScalar(_b)),
159 padding0__(0) {
160 (void)padding0__;
161 }
162 int16_t a() const {
163 return flatbuffers::EndianScalar(a_);
164 }
165 void mutate_a(int16_t _a) {
166 flatbuffers::WriteScalar(&a_, _a);
167 }
168 int8_t b() const {
169 return flatbuffers::EndianScalar(b_);
170 }
171 void mutate_b(int8_t _b) {
172 flatbuffers::WriteScalar(&b_, _b);
173 }
174 };
175 STRUCT_END(Test, 4);
176
177 MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
178 private:
179 float x_;
180 float y_;
181 float z_;
182 int32_t padding0__;
183 double test1_;
184 int8_t test2_;
185 int8_t padding1__;
186 Test test3_;
187 int16_t padding2__;
188
189 public:
190 Vec3() {
191 memset(this, 0, sizeof(Vec3));
192 }
193 Vec3(const Vec3 &_o) {
194 memcpy(this, &_o, sizeof(Vec3));
195 }
196 Vec3(float _x, float _y, float _z, double _test1, Color _test2, const Test &_test3)
197 : x_(flatbuffers::EndianScalar(_x)),
198 y_(flatbuffers::EndianScalar(_y)),
199 z_(flatbuffers::EndianScalar(_z)),
200 padding0__(0),
201 test1_(flatbuffers::EndianScalar(_test1)),
202 test2_(flatbuffers::EndianScalar(static_cast<int8_t>(_test2))),
203 padding1__(0),
204 test3_(_test3),
205 padding2__(0) {
206 (void)padding0__;
207 (void)padding1__;
208 (void)padding2__;
209 }
210 float x() const {
211 return flatbuffers::EndianScalar(x_);
212 }
213 void mutate_x(float _x) {
214 flatbuffers::WriteScalar(&x_, _x);
215 }
216 float y() const {
217 return flatbuffers::EndianScalar(y_);
218 }
219 void mutate_y(float _y) {
220 flatbuffers::WriteScalar(&y_, _y);
221 }
222 float z() const {
223 return flatbuffers::EndianScalar(z_);
224 }
225 void mutate_z(float _z) {
226 flatbuffers::WriteScalar(&z_, _z);
227 }
228 double test1() const {
229 return flatbuffers::EndianScalar(test1_);
230 }
231 void mutate_test1(double _test1) {
232 flatbuffers::WriteScalar(&test1_, _test1);
233 }
234 Color test2() const {
235 return static_cast<Color>(flatbuffers::EndianScalar(test2_));
236 }
237 void mutate_test2(Color _test2) {
238 flatbuffers::WriteScalar(&test2_, static_cast<int8_t>(_test2));
239 }
240 const Test &test3() const {
241 return test3_;
242 }
243 const Test &mutable_test3() {
244 return test3_;
245 }
246 };
247 STRUCT_END(Vec3, 32);
248
249 } // namespace Example
250
251 namespace Example2 {
252
253 struct MonsterT : public flatbuffers::NativeTable {
254 typedef Monster TableType;
255 MonsterT() {
256 }
257 };
258
259 struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
260 typedef MonsterT NativeTableType;
261 bool Verify(flatbuffers::Verifier &verifier) const {
262 return VerifyTableStart(verifier) &&
263 verifier.EndTable();
264 }
265 MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
266 void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
267 static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
268 };
269
270 struct MonsterBuilder {
271 flatbuffers::FlatBufferBuilder &fbb_;
272 flatbuffers::uoffset_t start_;
273 MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
274 : fbb_(_fbb) {
275 start_ = fbb_.StartTable();
276 }
277 MonsterBuilder &operator=(const MonsterBuilder &);
278 flatbuffers::Offset<Monster> Finish() {
279 const auto end = fbb_.EndTable(start_, 0);
280 auto o = flatbuffers::Offset<Monster>(end);
281 return o;
282 }
283 };
284
285 inline flatbuffers::Offset<Monster> CreateMonster(
286 flatbuffers::FlatBufferBuilder &_fbb) {
287 MonsterBuilder builder_(_fbb);
288 return builder_.Finish();
289 }
290
291 flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
292
293 } // namespace Example2
294
295 namespace Example {
296
297 struct TestSimpleTableWithEnumT : public flatbuffers::NativeTable {
298 typedef TestSimpleTableWithEnum TableType;
299 Color color;
300 TestSimpleTableWithEnumT()
301 : color(Color_Green) {
302 }
303 };
304
305 struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
306 typedef TestSimpleTableWithEnumT NativeTableType;
307 enum {
308 VT_COLOR = 4
309 };
310 Color color() const {
311 return static_cast<Color>(GetField<int8_t>(VT_COLOR, 2));
312 }
313 bool mutate_color(Color _color) {
314 return SetField(VT_COLOR, static_cast<int8_t>(_color));
315 }
316 bool Verify(flatbuffers::Verifier &verifier) const {
317 return VerifyTableStart(verifier) &&
318 VerifyField<int8_t>(verifier, VT_COLOR) &&
319 verifier.EndTable();
320 }
321 TestSimpleTableWithEnumT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
322 void UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
323 static flatbuffers::Offset<TestSimpleTableWithEnum> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
324 };
325
326 struct TestSimpleTableWithEnumBuilder {
327 flatbuffers::FlatBufferBuilder &fbb_;
328 flatbuffers::uoffset_t start_;
329 void add_color(Color color) {
330 fbb_.AddElement<int8_t>(TestSimpleTableWithEnum::VT_COLOR, static_cast<int8_t>(color), 2);
331 }
332 TestSimpleTableWithEnumBuilder(flatbuffers::FlatBufferBuilder &_fbb)
333 : fbb_(_fbb) {
334 start_ = fbb_.StartTable();
335 }
336 TestSimpleTableWithEnumBuilder &operator=(const TestSimpleTableWithEnumBuilder &);
337 flatbuffers::Offset<TestSimpleTableWithEnum> Finish() {
338 const auto end = fbb_.EndTable(start_, 1);
339 auto o = flatbuffers::Offset<TestSimpleTableWithEnum>(end);
340 return o;
341 }
342 };
343
344 inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(
345 flatbuffers::FlatBufferBuilder &_fbb,
346 Color color = Color_Green) {
347 TestSimpleTableWithEnumBuilder builder_(_fbb);
348 builder_.add_color(color);
349 return builder_.Finish();
350 }
351
352 flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
353
354 struct StatT : public flatbuffers::NativeTable {
355 typedef Stat TableType;
356 std::string id;
357 int64_t val;
358 uint16_t count;
359 StatT()
360 : val(0),
361 count(0) {
362 }
363 };
364
365 struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
366 typedef StatT NativeTableType;
367 enum {
368 VT_ID = 4,
369 VT_VAL = 6,
370 VT_COUNT = 8
371 };
372 const flatbuffers::String *id() const {
373 return GetPointer<const flatbuffers::String *>(VT_ID);
374 }
375 flatbuffers::String *mutable_id() {
376 return GetPointer<flatbuffers::String *>(VT_ID);
377 }
378 int64_t val() const {
379 return GetField<int64_t>(VT_VAL, 0);
380 }
381 bool mutate_val(int64_t _val) {
382 return SetField(VT_VAL, _val);
383 }
384 uint16_t count() const {
385 return GetField<uint16_t>(VT_COUNT, 0);
386 }
387 bool mutate_count(uint16_t _count) {
388 return SetField(VT_COUNT, _count);
389 }
390 bool Verify(flatbuffers::Verifier &verifier) const {
391 return VerifyTableStart(verifier) &&
392 VerifyField<flatbuffers::uoffset_t>(verifier, VT_ID) &&
393 verifier.Verify(id()) &&
394 VerifyField<int64_t>(verifier, VT_VAL) &&
395 VerifyField<uint16_t>(verifier, VT_COUNT) &&
396 verifier.EndTable();
397 }
398 StatT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
399 void UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
400 static flatbuffers::Offset<Stat> Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
401 };
402
403 struct StatBuilder {
404 flatbuffers::FlatBufferBuilder &fbb_;
405 flatbuffers::uoffset_t start_;
406 void add_id(flatbuffers::Offset<flatbuffers::String> id) {
407 fbb_.AddOffset(Stat::VT_ID, id);
408 }
409 void add_val(int64_t val) {
410 fbb_.AddElement<int64_t>(Stat::VT_VAL, val, 0);
411 }
412 void add_count(uint16_t count) {
413 fbb_.AddElement<uint16_t>(Stat::VT_COUNT, count, 0);
414 }
415 StatBuilder(flatbuffers::FlatBufferBuilder &_fbb)
416 : fbb_(_fbb) {
417 start_ = fbb_.StartTable();
418 }
419 StatBuilder &operator=(const StatBuilder &);
420 flatbuffers::Offset<Stat> Finish() {
421 const auto end = fbb_.EndTable(start_, 3);
422 auto o = flatbuffers::Offset<Stat>(end);
423 return o;
424 }
425 };
426
427 inline flatbuffers::Offset<Stat> CreateStat(
428 flatbuffers::FlatBufferBuilder &_fbb,
429 flatbuffers::Offset<flatbuffers::String> id = 0,
430 int64_t val = 0,
431 uint16_t count = 0) {
432 StatBuilder builder_(_fbb);
433 builder_.add_val(val);
434 builder_.add_id(id);
435 builder_.add_count(count);
436 return builder_.Finish();
437 }
438
439 inline flatbuffers::Offset<Stat> CreateStatDirect(
440 flatbuffers::FlatBufferBuilder &_fbb,
441 const char *id = nullptr,
442 int64_t val = 0,
443 uint16_t count = 0) {
444 return MyGame::Example::CreateStat(
445 _fbb,
446 id ? _fbb.CreateString(id) : 0,
447 val,
448 count);
449 }
450
451 flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
452
453 struct MonsterT : public flatbuffers::NativeTable {
454 typedef Monster TableType;
455 std::unique_ptr<Vec3> pos;
456 int16_t mana;
457 int16_t hp;
458 std::string name;
459 std::vector<uint8_t> inventory;
460 Color color;
461 AnyUnion test;
462 std::vector<Test> test4;
463 std::vector<std::string> testarrayofstring;
464 std::vector<std::unique_ptr<MonsterT>> testarrayoftables;
465 std::unique_ptr<MonsterT> enemy;
466 std::vector<uint8_t> testnestedflatbuffer;
467 std::unique_ptr<StatT> testempty;
468 bool testbool;
469 int32_t testhashs32_fnv1;
470 uint32_t testhashu32_fnv1;
471 int64_t testhashs64_fnv1;
472 uint64_t testhashu64_fnv1;
473 int32_t testhashs32_fnv1a;
474 Stat *testhashu32_fnv1a;
475 int64_t testhashs64_fnv1a;
476 uint64_t testhashu64_fnv1a;
477 std::vector<bool> testarrayofbools;
478 float testf;
479 float testf2;
480 float testf3;
481 std::vector<std::string> testarrayofstring2;
482 MonsterT()
483 : mana(150),
484 hp(100),
485 color(Color_Blue),
486 testbool(false),
487 testhashs32_fnv1(0),
488 testhashu32_fnv1(0),
489 testhashs64_fnv1(0),
490 testhashu64_fnv1(0),
491 testhashs32_fnv1a(0),
492 testhashu32_fnv1a(0),
493 testhashs64_fnv1a(0),
494 testhashu64_fnv1a(0),
495 testf(3.14159f),
496 testf2(3.0f),
497 testf3(0.0f) {
498 }
499 };
500
501 /// an example documentation comment: monster object
502 struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
503 typedef MonsterT NativeTableType;
504 enum {
505 VT_POS = 4,
506 VT_MANA = 6,
507 VT_HP = 8,
508 VT_NAME = 10,
509 VT_INVENTORY = 14,
510 VT_COLOR = 16,
511 VT_TEST_TYPE = 18,
512 VT_TEST = 20,
513 VT_TEST4 = 22,
514 VT_TESTARRAYOFSTRING = 24,
515 VT_TESTARRAYOFTABLES = 26,
516 VT_ENEMY = 28,
517 VT_TESTNESTEDFLATBUFFER = 30,
518 VT_TESTEMPTY = 32,
519 VT_TESTBOOL = 34,
520 VT_TESTHASHS32_FNV1 = 36,
521 VT_TESTHASHU32_FNV1 = 38,
522 VT_TESTHASHS64_FNV1 = 40,
523 VT_TESTHASHU64_FNV1 = 42,
524 VT_TESTHASHS32_FNV1A = 44,
525 VT_TESTHASHU32_FNV1A = 46,
526 VT_TESTHASHS64_FNV1A = 48,
527 VT_TESTHASHU64_FNV1A = 50,
528 VT_TESTARRAYOFBOOLS = 52,
529 VT_TESTF = 54,
530 VT_TESTF2 = 56,
531 VT_TESTF3 = 58,
532 VT_TESTARRAYOFSTRING2 = 60
533 };
534 const Vec3 *pos() const {
535 return GetStruct<const Vec3 *>(VT_POS);
536 }
537 Vec3 *mutable_pos() {
538 return GetStruct<Vec3 *>(VT_POS);
539 }
540 int16_t mana() const {
541 return GetField<int16_t>(VT_MANA, 150);
542 }
543 bool mutate_mana(int16_t _mana) {
544 return SetField(VT_MANA, _mana);
545 }
546 int16_t hp() const {
547 return GetField<int16_t>(VT_HP, 100);
548 }
549 bool mutate_hp(int16_t _hp) {
550 return SetField(VT_HP, _hp);
551 }
552 const flatbuffers::String *name() const {
553 return GetPointer<const flatbuffers::String *>(VT_NAME);
554 }
555 flatbuffers::String *mutable_name() {
556 return GetPointer<flatbuffers::String *>(VT_NAME);
557 }
558 bool KeyCompareLessThan(const Monster *o) const {
559 return *name() < *o->name();
560 }
561 int KeyCompareWithValue(const char *val) const {
562 return strcmp(name()->c_str(), val);
563 }
564 const flatbuffers::Vector<uint8_t> *inventory() const {
565 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
566 }
567 flatbuffers::Vector<uint8_t> *mutable_inventory() {
568 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
569 }
570 Color color() const {
571 return static_cast<Color>(GetField<int8_t>(VT_COLOR, 8));
572 }
573 bool mutate_color(Color _color) {
574 return SetField(VT_COLOR, static_cast<int8_t>(_color));
575 }
576 Any test_type() const {
577 return static_cast<Any>(GetField<uint8_t>(VT_TEST_TYPE, 0));
578 }
579 bool mutate_test_type(Any _test_type) {
580 return SetField(VT_TEST_TYPE, static_cast<uint8_t>(_test_type));
581 }
582 const void *test() const {
583 return GetPointer<const void *>(VT_TEST);
584 }
585 void *mutable_test() {
586 return GetPointer<void *>(VT_TEST);
587 }
588 const flatbuffers::Vector<const Test *> *test4() const {
589 return GetPointer<const flatbuffers::Vector<const Test *> *>(VT_TEST4);
590 }
591 flatbuffers::Vector<const Test *> *mutable_test4() {
592 return GetPointer<flatbuffers::Vector<const Test *> *>(VT_TEST4);
593 }
594 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring() const {
595 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
596 }
597 flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring() {
598 return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
599 }
600 /// an example documentation comment: this will end up in the generated code
601 /// multiline too
602 const flatbuffers::Vector<flatbuffers::Offset<Monster>> *testarrayoftables() const {
603 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Monster>> *>(VT_TESTARRAYOFTABLES);
604 }
605 flatbuffers::Vector<flatbuffers::Offset<Monster>> *mutable_testarrayoftables() {
606 return GetPointer<flatbuffers::Vector<flatbuffers::Offset<Monster>> *>(VT_TESTARRAYOFTABLES);
607 }
608 const Monster *enemy() const {
609 return GetPointer<const Monster *>(VT_ENEMY);
610 }
611 Monster *mutable_enemy() {
612 return GetPointer<Monster *>(VT_ENEMY);
613 }
614 const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const {
615 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
616 }
617 flatbuffers::Vector<uint8_t> *mutable_testnestedflatbuffer() {
618 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
619 }
620 const MyGame::Example::Monster *testnestedflatbuffer_nested_root() const {
621 const uint8_t* data = testnestedflatbuffer()->Data();
622 return flatbuffers::GetRoot<MyGame::Example::Monster>(data);
623 }
624 const Stat *testempty() const {
625 return GetPointer<const Stat *>(VT_TESTEMPTY);
626 }
627 Stat *mutable_testempty() {
628 return GetPointer<Stat *>(VT_TESTEMPTY);
629 }
630 bool testbool() const {
631 return GetField<uint8_t>(VT_TESTBOOL, 0) != 0;
632 }
633 bool mutate_testbool(bool _testbool) {
634 return SetField(VT_TESTBOOL, static_cast<uint8_t>(_testbool));
635 }
636 int32_t testhashs32_fnv1() const {
637 return GetField<int32_t>(VT_TESTHASHS32_FNV1, 0);
638 }
639 bool mutate_testhashs32_fnv1(int32_t _testhashs32_fnv1) {
640 return SetField(VT_TESTHASHS32_FNV1, _testhashs32_fnv1);
641 }
642 uint32_t testhashu32_fnv1() const {
643 return GetField<uint32_t>(VT_TESTHASHU32_FNV1, 0);
644 }
645 bool mutate_testhashu32_fnv1(uint32_t _testhashu32_fnv1) {
646 return SetField(VT_TESTHASHU32_FNV1, _testhashu32_fnv1);
647 }
648 int64_t testhashs64_fnv1() const {
649 return GetField<int64_t>(VT_TESTHASHS64_FNV1, 0);
650 }
651 bool mutate_testhashs64_fnv1(int64_t _testhashs64_fnv1) {
652 return SetField(VT_TESTHASHS64_FNV1, _testhashs64_fnv1);
653 }
654 uint64_t testhashu64_fnv1() const {
655 return GetField<uint64_t>(VT_TESTHASHU64_FNV1, 0);
656 }
657 bool mutate_testhashu64_fnv1(uint64_t _testhashu64_fnv1) {
658 return SetField(VT_TESTHASHU64_FNV1, _testhashu64_fnv1);
659 }
660 int32_t testhashs32_fnv1a() const {
661 return GetField<int32_t>(VT_TESTHASHS32_FNV1A, 0);
662 }
663 bool mutate_testhashs32_fnv1a(int32_t _testhashs32_fnv1a) {
664 return SetField(VT_TESTHASHS32_FNV1A, _testhashs32_fnv1a);
665 }
666 uint32_t testhashu32_fnv1a() const {
667 return GetField<uint32_t>(VT_TESTHASHU32_FNV1A, 0);
668 }
669 bool mutate_testhashu32_fnv1a(uint32_t _testhashu32_fnv1a) {
670 return SetField(VT_TESTHASHU32_FNV1A, _testhashu32_fnv1a);
671 }
672 int64_t testhashs64_fnv1a() const {
673 return GetField<int64_t>(VT_TESTHASHS64_FNV1A, 0);
674 }
675 bool mutate_testhashs64_fnv1a(int64_t _testhashs64_fnv1a) {
676 return SetField(VT_TESTHASHS64_FNV1A, _testhashs64_fnv1a);
677 }
678 uint64_t testhashu64_fnv1a() const {
679 return GetField<uint64_t>(VT_TESTHASHU64_FNV1A, 0);
680 }
681 bool mutate_testhashu64_fnv1a(uint64_t _testhashu64_fnv1a) {
682 return SetField(VT_TESTHASHU64_FNV1A, _testhashu64_fnv1a);
683 }
684 const flatbuffers::Vector<uint8_t> *testarrayofbools() const {
685 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
686 }
687 flatbuffers::Vector<uint8_t> *mutable_testarrayofbools() {
688 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
689 }
690 float testf() const {
691 return GetField<float>(VT_TESTF, 3.14159f);
692 }
693 bool mutate_testf(float _testf) {
694 return SetField(VT_TESTF, _testf);
695 }
696 float testf2() const {
697 return GetField<float>(VT_TESTF2, 3.0f);
698 }
699 bool mutate_testf2(float _testf2) {
700 return SetField(VT_TESTF2, _testf2);
701 }
702 float testf3() const {
703 return GetField<float>(VT_TESTF3, 0.0f);
704 }
705 bool mutate_testf3(float _testf3) {
706 return SetField(VT_TESTF3, _testf3);
707 }
708 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2() const {
709 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
710 }
711 flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring2() {
712 return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
713 }
714 bool Verify(flatbuffers::Verifier &verifier) const {
715 return VerifyTableStart(verifier) &&
716 VerifyField<Vec3>(verifier, VT_POS) &&
717 VerifyField<int16_t>(verifier, VT_MANA) &&
718 VerifyField<int16_t>(verifier, VT_HP) &&
719 VerifyFieldRequired<flatbuffers::uoffset_t>(verifier, VT_NAME) &&
720 verifier.Verify(name()) &&
721 VerifyField<flatbuffers::uoffset_t>(verifier, VT_INVENTORY) &&
722 verifier.Verify(inventory()) &&
723 VerifyField<int8_t>(verifier, VT_COLOR) &&
724 VerifyField<uint8_t>(verifier, VT_TEST_TYPE) &&
725 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TEST) &&
726 VerifyAny(verifier, test(), test_type()) &&
727 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TEST4) &&
728 verifier.Verify(test4()) &&
729 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TESTARRAYOFSTRING) &&
730 verifier.Verify(testarrayofstring()) &&
731 verifier.VerifyVectorOfStrings(testarrayofstring()) &&
732 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TESTARRAYOFTABLES) &&
733 verifier.Verify(testarrayoftables()) &&
734 verifier.VerifyVectorOfTables(testarrayoftables()) &&
735 VerifyField<flatbuffers::uoffset_t>(verifier, VT_ENEMY) &&
736 verifier.VerifyTable(enemy()) &&
737 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TESTNESTEDFLATBUFFER) &&
738 verifier.Verify(testnestedflatbuffer()) &&
739 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TESTEMPTY) &&
740 verifier.VerifyTable(testempty()) &&
741 VerifyField<uint8_t>(verifier, VT_TESTBOOL) &&
742 VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1) &&
743 VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1) &&
744 VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1) &&
745 VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1) &&
746 VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1A) &&
747 VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1A) &&
748 VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1A) &&
749 VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1A) &&
750 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TESTARRAYOFBOOLS) &&
751 verifier.Verify(testarrayofbools()) &&
752 VerifyField<float>(verifier, VT_TESTF) &&
753 VerifyField<float>(verifier, VT_TESTF2) &&
754 VerifyField<float>(verifier, VT_TESTF3) &&
755 VerifyField<flatbuffers::uoffset_t>(verifier, VT_TESTARRAYOFSTRING2) &&
756 verifier.Verify(testarrayofstring2()) &&
757 verifier.VerifyVectorOfStrings(testarrayofstring2()) &&
758 verifier.EndTable();
759 }
760 MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
761 void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
762 static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
763 };
764
765 struct MonsterBuilder {
766 flatbuffers::FlatBufferBuilder &fbb_;
767 flatbuffers::uoffset_t start_;
768 void add_pos(const Vec3 *pos) {
769 fbb_.AddStruct(Monster::VT_POS, pos);
770 }
771 void add_mana(int16_t mana) {
772 fbb_.AddElement<int16_t>(Monster::VT_MANA, mana, 150);
773 }
774 void add_hp(int16_t hp) {
775 fbb_.AddElement<int16_t>(Monster::VT_HP, hp, 100);
776 }
777 void add_name(flatbuffers::Offset<flatbuffers::String> name) {
778 fbb_.AddOffset(Monster::VT_NAME, name);
779 }
780 void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) {
781 fbb_.AddOffset(Monster::VT_INVENTORY, inventory);
782 }
783 void add_color(Color color) {
784 fbb_.AddElement<int8_t>(Monster::VT_COLOR, static_cast<int8_t>(color), 8);
785 }
786 void add_test_type(Any test_type) {
787 fbb_.AddElement<uint8_t>(Monster::VT_TEST_TYPE, static_cast<uint8_t>(test_type), 0);
788 }
789 void add_test(flatbuffers::Offset<void> test) {
790 fbb_.AddOffset(Monster::VT_TEST, test);
791 }
792 void add_test4(flatbuffers::Offset<flatbuffers::Vector<const Test *>> test4) {
793 fbb_.AddOffset(Monster::VT_TEST4, test4);
794 }
795 void add_testarrayofstring(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring) {
796 fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
797 }
798 void add_testarrayoftables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables) {
799 fbb_.AddOffset(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
800 }
801 void add_enemy(flatbuffers::Offset<Monster> enemy) {
802 fbb_.AddOffset(Monster::VT_ENEMY, enemy);
803 }
804 void add_testnestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer) {
805 fbb_.AddOffset(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
806 }
807 void add_testempty(flatbuffers::Offset<Stat> testempty) {
808 fbb_.AddOffset(Monster::VT_TESTEMPTY, testempty);
809 }
810 void add_testbool(bool testbool) {
811 fbb_.AddElement<uint8_t>(Monster::VT_TESTBOOL, static_cast<uint8_t>(testbool), 0);
812 }
813 void add_testhashs32_fnv1(int32_t testhashs32_fnv1) {
814 fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
815 }
816 void add_testhashu32_fnv1(uint32_t testhashu32_fnv1) {
817 fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
818 }
819 void add_testhashs64_fnv1(int64_t testhashs64_fnv1) {
820 fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
821 }
822 void add_testhashu64_fnv1(uint64_t testhashu64_fnv1) {
823 fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
824 }
825 void add_testhashs32_fnv1a(int32_t testhashs32_fnv1a) {
826 fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
827 }
828 void add_testhashu32_fnv1a(uint32_t testhashu32_fnv1a) {
829 fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
830 }
831 void add_testhashs64_fnv1a(int64_t testhashs64_fnv1a) {
832 fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
833 }
834 void add_testhashu64_fnv1a(uint64_t testhashu64_fnv1a) {
835 fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
836 }
837 void add_testarrayofbools(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools) {
838 fbb_.AddOffset(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
839 }
840 void add_testf(float testf) {
841 fbb_.AddElement<float>(Monster::VT_TESTF, testf, 3.14159f);
842 }
843 void add_testf2(float testf2) {
844 fbb_.AddElement<float>(Monster::VT_TESTF2, testf2, 3.0f);
845 }
846 void add_testf3(float testf3) {
847 fbb_.AddElement<float>(Monster::VT_TESTF3, testf3, 0.0f);
848 }
849 void add_testarrayofstring2(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2) {
850 fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
851 }
852 MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
853 : fbb_(_fbb) {
854 start_ = fbb_.StartTable();
855 }
856 MonsterBuilder &operator=(const MonsterBuilder &);
857 flatbuffers::Offset<Monster> Finish() {
858 const auto end = fbb_.EndTable(start_, 29);
859 auto o = flatbuffers::Offset<Monster>(end);
860 fbb_.Required(o, Monster::VT_NAME);
861 return o;
862 }
863 };
864
865 inline flatbuffers::Offset<Monster> CreateMonster(
866 flatbuffers::FlatBufferBuilder &_fbb,
867 const Vec3 *pos = 0,
868 int16_t mana = 150,
869 int16_t hp = 100,
870 flatbuffers::Offset<flatbuffers::String> name = 0,
871 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory = 0,
872 Color color = Color_Blue,
873 Any test_type = Any_NONE,
874 flatbuffers::Offset<void> test = 0,
875 flatbuffers::Offset<flatbuffers::Vector<const Test *>> test4 = 0,
876 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring = 0,
877 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables = 0,
878 flatbuffers::Offset<Monster> enemy = 0,
879 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer = 0,
880 flatbuffers::Offset<Stat> testempty = 0,
881 bool testbool = false,
882 int32_t testhashs32_fnv1 = 0,
883 uint32_t testhashu32_fnv1 = 0,
884 int64_t testhashs64_fnv1 = 0,
885 uint64_t testhashu64_fnv1 = 0,
886 int32_t testhashs32_fnv1a = 0,
887 uint32_t testhashu32_fnv1a = 0,
888 int64_t testhashs64_fnv1a = 0,
889 uint64_t testhashu64_fnv1a = 0,
890 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools = 0,
891 float testf = 3.14159f,
892 float testf2 = 3.0f,
893 float testf3 = 0.0f,
894 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2 = 0) {
895 MonsterBuilder builder_(_fbb);
896 builder_.add_testhashu64_fnv1a(testhashu64_fnv1a);
897 builder_.add_testhashs64_fnv1a(testhashs64_fnv1a);
898 builder_.add_testhashu64_fnv1(testhashu64_fnv1);
899 builder_.add_testhashs64_fnv1(testhashs64_fnv1);
900 builder_.add_testarrayofstring2(testarrayofstring2);
901 builder_.add_testf3(testf3);
902 builder_.add_testf2(testf2);
903 builder_.add_testf(testf);
904 builder_.add_testarrayofbools(testarrayofbools);
905 builder_.add_testhashu32_fnv1a(testhashu32_fnv1a);
906 builder_.add_testhashs32_fnv1a(testhashs32_fnv1a);
907 builder_.add_testhashu32_fnv1(testhashu32_fnv1);
908 builder_.add_testhashs32_fnv1(testhashs32_fnv1);
909 builder_.add_testempty(testempty);
910 builder_.add_testnestedflatbuffer(testnestedflatbuffer);
911 builder_.add_enemy(enemy);
912 builder_.add_testarrayoftables(testarrayoftables);
913 builder_.add_testarrayofstring(testarrayofstring);
914 builder_.add_test4(test4);
915 builder_.add_test(test);
916 builder_.add_inventory(inventory);
917 builder_.add_name(name);
918 builder_.add_pos(pos);
919 builder_.add_hp(hp);
920 builder_.add_mana(mana);
921 builder_.add_testbool(testbool);
922 builder_.add_test_type(test_type);
923 builder_.add_color(color);
924 return builder_.Finish();
925 }
926
927 inline flatbuffers::Offset<Monster> CreateMonsterDirect(
928 flatbuffers::FlatBufferBuilder &_fbb,
929 const Vec3 *pos = 0,
930 int16_t mana = 150,
931 int16_t hp = 100,
932 const char *name = nullptr,
933 const std::vector<uint8_t> *inventory = nullptr,
934 Color color = Color_Blue,
935 Any test_type = Any_NONE,
936 flatbuffers::Offset<void> test = 0,
937 const std::vector<const Test *> *test4 = nullptr,
938 const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring = nullptr,
939 const std::vector<flatbuffers::Offset<Monster>> *testarrayoftables = nullptr,
940 flatbuffers::Offset<Monster> enemy = 0,
941 const std::vector<uint8_t> *testnestedflatbuffer = nullptr,
942 flatbuffers::Offset<Stat> testempty = 0,
943 bool testbool = false,
944 int32_t testhashs32_fnv1 = 0,
945 uint32_t testhashu32_fnv1 = 0,
946 int64_t testhashs64_fnv1 = 0,
947 uint64_t testhashu64_fnv1 = 0,
948 int32_t testhashs32_fnv1a = 0,
949 uint32_t testhashu32_fnv1a = 0,
950 int64_t testhashs64_fnv1a = 0,
951 uint64_t testhashu64_fnv1a = 0,
952 const std::vector<uint8_t> *testarrayofbools = nullptr,
953 float testf = 3.14159f,
954 float testf2 = 3.0f,
955 float testf3 = 0.0f,
956 const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2 = nullptr) {
957 return MyGame::Example::CreateMonster(
958 _fbb,
959 pos,
960 mana,
961 hp,
962 name ? _fbb.CreateString(name) : 0,
963 inventory ? _fbb.CreateVector<uint8_t>(*inventory) : 0,
964 color,
965 test_type,
966 test,
967 test4 ? _fbb.CreateVector<const Test *>(*test4) : 0,
968 testarrayofstring ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring) : 0,
969 testarrayoftables ? _fbb.CreateVector<flatbuffers::Offset<Monster>>(*testarrayoftables) : 0,
970 enemy,
971 testnestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testnestedflatbuffer) : 0,
972 testempty,
973 testbool,
974 testhashs32_fnv1,
975 testhashu32_fnv1,
976 testhashs64_fnv1,
977 testhashu64_fnv1,
978 testhashs32_fnv1a,
979 testhashu32_fnv1a,
980 testhashs64_fnv1a,
981 testhashu64_fnv1a,
982 testarrayofbools ? _fbb.CreateVector<uint8_t>(*testarrayofbools) : 0,
983 testf,
984 testf2,
985 testf3,
986 testarrayofstring2 ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring2) : 0);
987 }
988
989 flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
990
991 } // namespace Example
992
993 namespace Example2 {
994
995 inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
996 auto _o = new MonsterT();
997 UnPackTo(_o, _resolver);
998 return _o;
999 }
1000
1001 inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1002 (void)_o;
1003 (void)_resolver;
1004 }
1005
1006 inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1007 return CreateMonster(_fbb, _o, _rehasher);
1008 }
1009
1010 inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1011 (void)_rehasher;
1012 (void)_o;
1013 return MyGame::Example2::CreateMonster(
1014 _fbb);
1015 }
1016
1017 } // namespace Example2
1018
1019 namespace Example {
1020
1021 inline TestSimpleTableWithEnumT *TestSimpleTableWithEnum::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1022 auto _o = new TestSimpleTableWithEnumT();
1023 UnPackTo(_o, _resolver);
1024 return _o;
1025 }
1026
1027 inline void TestSimpleTableWithEnum::UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1028 (void)_o;
1029 (void)_resolver;
1030 { auto _e = color(); _o->color = _e; };
1031 }
1032
1033 inline flatbuffers::Offset<TestSimpleTableWithEnum> TestSimpleTableWithEnum::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1034 return CreateTestSimpleTableWithEnum(_fbb, _o, _rehasher);
1035 }
1036
1037 inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1038 (void)_rehasher;
1039 (void)_o;
1040 auto _color = _o->color;
1041 return MyGame::Example::CreateTestSimpleTableWithEnum(
1042 _fbb,
1043 _color);
1044 }
1045
1046 inline StatT *Stat::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1047 auto _o = new StatT();
1048 UnPackTo(_o, _resolver);
1049 return _o;
1050 }
1051
1052 inline void Stat::UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1053 (void)_o;
1054 (void)_resolver;
1055 { auto _e = id(); if (_e) _o->id = _e->str(); };
1056 { auto _e = val(); _o->val = _e; };
1057 { auto _e = count(); _o->count = _e; };
1058 }
1059
1060 inline flatbuffers::Offset<Stat> Stat::Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1061 return CreateStat(_fbb, _o, _rehasher);
1062 }
1063
1064 inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1065 (void)_rehasher;
1066 (void)_o;
1067 auto _id = _o->id.size() ? _fbb.CreateString(_o->id) : 0;
1068 auto _val = _o->val;
1069 auto _count = _o->count;
1070 return MyGame::Example::CreateStat(
1071 _fbb,
1072 _id,
1073 _val,
1074 _count);
1075 }
1076
1077 inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
1078 auto _o = new MonsterT();
1079 UnPackTo(_o, _resolver);
1080 return _o;
1081 }
1082
1083 inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
1084 (void)_o;
1085 (void)_resolver;
1086 { auto _e = pos(); if (_e) _o->pos = std::unique_ptr<Vec3>(new Vec3(*_e)); };
1087 { auto _e = mana(); _o->mana = _e; };
1088 { auto _e = hp(); _o->hp = _e; };
1089 { auto _e = name(); if (_e) _o->name = _e->str(); };
1090 { auto _e = inventory(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->inventory.push_back(_e->Get(_i)); } };
1091 { auto _e = color(); _o->color = _e; };
1092 { auto _e = test_type(); _o->test.type = _e; };
1093 { auto _e = test(); if (_e) _o->test.table = AnyUnion::UnPack(_e, test_type(),_resolver); };
1094 { auto _e = test4(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4.push_back(*_e->Get(_i)); } };
1095 { auto _e = testarrayofstring(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring.push_back(_e->Get(_i)->str()); } };
1096 { auto _e = testarrayoftables(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayoftables.push_back(std::unique_ptr<MonsterT>(_e->Get(_i)->UnPack(_resolver))); } };
1097 { auto _e = enemy(); if (_e) _o->enemy = std::unique_ptr<MonsterT>(_e->UnPack(_resolver)); };
1098 { auto _e = testnestedflatbuffer(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testnestedflatbuffer.push_back(_e->Get(_i)); } };
1099 { auto _e = testempty(); if (_e) _o->testempty = std::unique_ptr<StatT>(_e->UnPack(_resolver)); };
1100 { auto _e = testbool(); _o->testbool = _e; };
1101 { auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; };
1102 { auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; };
1103 { auto _e = testhashs64_fnv1(); _o->testhashs64_fnv1 = _e; };
1104 { auto _e = testhashu64_fnv1(); _o->testhashu64_fnv1 = _e; };
1105 { auto _e = testhashs32_fnv1a(); _o->testhashs32_fnv1a = _e; };
1106 { auto _e = testhashu32_fnv1a(); if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; };
1107 { auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; };
1108 { auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; };
1109 { auto _e = testarrayofbools(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools.push_back(_e->Get(_i) != 0); } };
1110 { auto _e = testf(); _o->testf = _e; };
1111 { auto _e = testf2(); _o->testf2 = _e; };
1112 { auto _e = testf3(); _o->testf3 = _e; };
1113 { auto _e = testarrayofstring2(); if (_e) for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2.push_back(_e->Get(_i)->str()); } };
1114 }
1115
1116 inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
1117 return CreateMonster(_fbb, _o, _rehasher);
1118 }
1119
1120 inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
1121 (void)_rehasher;
1122 (void)_o;
1123 auto _pos = _o->pos ? _o->pos.get() : 0;
1124 auto _mana = _o->mana;
1125 auto _hp = _o->hp;
1126 auto _name = _fbb.CreateString(_o->name);
1127 auto _inventory = _o->inventory.size() ? _fbb.CreateVector(_o->inventory) : 0;
1128 auto _color = _o->color;
1129 auto _test_type = _o->test.type;
1130 auto _test = _o->test.Pack(_fbb);
1131 auto _test4 = _o->test4.size() ? _fbb.CreateVectorOfStructs(_o->test4) : 0;
1132 auto _testarrayofstring = _o->testarrayofstring.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring) : 0;
1133 auto _testarrayoftables = _o->testarrayoftables.size() ? _fbb.CreateVector<flatbuffers::Offset<Monster>>(_o->testarrayoftables.size(), [&](size_t i) { return CreateMonster(_fbb, _o->testarrayoftables[i].get(), _rehasher); }) : 0;
1134 auto _enemy = _o->enemy ? CreateMonster(_fbb, _o->enemy.get(), _rehasher) : 0;
1135 auto _testnestedflatbuffer = _o->testnestedflatbuffer.size() ? _fbb.CreateVector(_o->testnestedflatbuffer) : 0;
1136 auto _testempty = _o->testempty ? CreateStat(_fbb, _o->testempty.get(), _rehasher) : 0;
1137 auto _testbool = _o->testbool;
1138 auto _testhashs32_fnv1 = _o->testhashs32_fnv1;
1139 auto _testhashu32_fnv1 = _o->testhashu32_fnv1;
1140 auto _testhashs64_fnv1 = _o->testhashs64_fnv1;
1141 auto _testhashu64_fnv1 = _o->testhashu64_fnv1;
1142 auto _testhashs32_fnv1a = _o->testhashs32_fnv1a;
1143 auto _testhashu32_fnv1a = _rehasher ? static_cast<uint32_t>((*_rehasher)(_o->testhashu32_fnv1a)) : 0;
1144 auto _testhashs64_fnv1a = _o->testhashs64_fnv1a;
1145 auto _testhashu64_fnv1a = _o->testhashu64_fnv1a;
1146 auto _testarrayofbools = _o->testarrayofbools.size() ? _fbb.CreateVector(_o->testarrayofbools) : 0;
1147 auto _testf = _o->testf;
1148 auto _testf2 = _o->testf2;
1149 auto _testf3 = _o->testf3;
1150 auto _testarrayofstring2 = _o->testarrayofstring2.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring2) : 0;
1151 return MyGame::Example::CreateMonster(
1152 _fbb,
1153 _pos,
1154 _mana,
1155 _hp,
1156 _name,
1157 _inventory,
1158 _color,
1159 _test_type,
1160 _test,
1161 _test4,
1162 _testarrayofstring,
1163 _testarrayoftables,
1164 _enemy,
1165 _testnestedflatbuffer,
1166 _testempty,
1167 _testbool,
1168 _testhashs32_fnv1,
1169 _testhashu32_fnv1,
1170 _testhashs64_fnv1,
1171 _testhashu64_fnv1,
1172 _testhashs32_fnv1a,
1173 _testhashu32_fnv1a,
1174 _testhashs64_fnv1a,
1175 _testhashu64_fnv1a,
1176 _testarrayofbools,
1177 _testf,
1178 _testf2,
1179 _testf3,
1180 _testarrayofstring2);
1181 }
1182
1183 inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) {
1184 switch (type) {
1185 case Any_NONE: {
1186 return true;
1187 }
1188 case Any_Monster: {
1189 auto ptr = reinterpret_cast<const Monster *>(obj);
1190 return verifier.VerifyTable(ptr);
1191 }
1192 case Any_TestSimpleTableWithEnum: {
1193 auto ptr = reinterpret_cast<const TestSimpleTableWithEnum *>(obj);
1194 return verifier.VerifyTable(ptr);
1195 }
1196 case Any_MyGame_Example2_Monster: {
1197 auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
1198 return verifier.VerifyTable(ptr);
1199 }
1200 default: return false;
1201 }
1202 }
1203
1204 inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
1205 if (values->size() != types->size()) return false;
1206 for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
1207 if (!VerifyAny(
1208 verifier, values->Get(i), types->GetEnum<Any>(i))) {
1209 return false;
1210 }
1211 }
1212 return true;
1213 }
1214
1215 inline flatbuffers::NativeTable *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
1216 switch (type) {
1217 case Any_Monster: {
1218 auto ptr = reinterpret_cast<const Monster *>(obj);
1219 return ptr->UnPack(resolver);
1220 }
1221 case Any_TestSimpleTableWithEnum: {
1222 auto ptr = reinterpret_cast<const TestSimpleTableWithEnum *>(obj);
1223 return ptr->UnPack(resolver);
1224 }
1225 case Any_MyGame_Example2_Monster: {
1226 auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
1227 return ptr->UnPack(resolver);
1228 }
1229 default: return nullptr;
1230 }
1231 }
1232
1233 inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
1234 switch (type) {
1235 case Any_Monster: {
1236 auto ptr = reinterpret_cast<const MonsterT *>(table);
1237 return CreateMonster(_fbb, ptr, _rehasher).Union();
1238 }
1239 case Any_TestSimpleTableWithEnum: {
1240 auto ptr = reinterpret_cast<const TestSimpleTableWithEnumT *>(table);
1241 return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
1242 }
1243 case Any_MyGame_Example2_Monster: {
1244 auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(table);
1245 return CreateMonster(_fbb, ptr, _rehasher).Union();
1246 }
1247 default: return 0;
1248 }
1249 }
1250
1251 inline void AnyUnion::Reset() {
1252 switch (type) {
1253 case Any_Monster: {
1254 auto ptr = reinterpret_cast<MonsterT *>(table);
1255 delete ptr;
1256 break;
1257 }
1258 case Any_TestSimpleTableWithEnum: {
1259 auto ptr = reinterpret_cast<TestSimpleTableWithEnumT *>(table);
1260 delete ptr;
1261 break;
1262 }
1263 case Any_MyGame_Example2_Monster: {
1264 auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(table);
1265 delete ptr;
1266 break;
1267 }
1268 default: break;
1269 }
1270 table = nullptr;
1271 type = Any_NONE;
1272 }
1273
1274 inline const MyGame::Example::Monster *GetMonster(const void *buf) {
1275 return flatbuffers::GetRoot<MyGame::Example::Monster>(buf);
1276 }
1277
1278 inline Monster *GetMutableMonster(void *buf) {
1279 return flatbuffers::GetMutableRoot<Monster>(buf);
1280 }
1281
1282 inline const char *MonsterIdentifier() {
1283 return "MONS";
1284 }
1285
1286 inline bool MonsterBufferHasIdentifier(const void *buf) {
1287 return flatbuffers::BufferHasIdentifier(
1288 buf, MonsterIdentifier());
1289 }
1290
1291 inline bool VerifyMonsterBuffer(
1292 flatbuffers::Verifier &verifier) {
1293 return verifier.VerifyBuffer<MyGame::Example::Monster>(MonsterIdentifier());
1294 }
1295
1296 inline const char *MonsterExtension() {
1297 return "mon";
1298 }
1299
1300 inline void FinishMonsterBuffer(
1301 flatbuffers::FlatBufferBuilder &fbb,
1302 flatbuffers::Offset<MyGame::Example::Monster> root) {
1303 fbb.Finish(root, MonsterIdentifier());
1304 }
1305
1306 inline std::unique_ptr<MonsterT> UnPackMonster(
1307 const void *buf,
1308 const flatbuffers::resolver_function_t *res = nullptr) {
1309 return std::unique_ptr<MonsterT>(GetMonster(buf)->UnPack(res));
1310 }
1311
1312 } // namespace Example
1313 } // namespace MyGame
1314
1315 #endif // FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
1316