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 #include "flatbuffers/flexbuffers.h" 9 10 namespace MyGame { 11 12 struct InParentNamespace; 13 struct InParentNamespaceT; 14 15 namespace Example2 { 16 17 struct Monster; 18 struct MonsterT; 19 20 } // namespace Example2 21 22 namespace Example { 23 24 struct Test; 25 26 struct TestSimpleTableWithEnum; 27 struct TestSimpleTableWithEnumT; 28 29 struct Vec3; 30 31 struct Ability; 32 33 struct Stat; 34 struct StatT; 35 36 struct Monster; 37 struct MonsterT; 38 39 struct TypeAliases; 40 struct TypeAliasesT; 41 42 enum Color { 43 Color_Red = 1, 44 Color_Green = 2, 45 Color_Blue = 8, 46 Color_NONE = 0, 47 Color_ANY = 11 48 }; 49 50 inline Color (&EnumValuesColor())[3] { 51 static Color values[] = { 52 Color_Red, 53 Color_Green, 54 Color_Blue 55 }; 56 return values; 57 } 58 59 inline const char **EnumNamesColor() { 60 static const char *names[] = { 61 "Red", 62 "Green", 63 "", 64 "", 65 "", 66 "", 67 "", 68 "Blue", 69 nullptr 70 }; 71 return names; 72 } 73 74 inline const char *EnumNameColor(Color e) { 75 const size_t index = static_cast<int>(e) - static_cast<int>(Color_Red); 76 return EnumNamesColor()[index]; 77 } 78 79 enum Any { 80 Any_NONE = 0, 81 Any_Monster = 1, 82 Any_TestSimpleTableWithEnum = 2, 83 Any_MyGame_Example2_Monster = 3, 84 Any_MIN = Any_NONE, 85 Any_MAX = Any_MyGame_Example2_Monster 86 }; 87 88 inline Any (&EnumValuesAny())[4] { 89 static Any values[] = { 90 Any_NONE, 91 Any_Monster, 92 Any_TestSimpleTableWithEnum, 93 Any_MyGame_Example2_Monster 94 }; 95 return values; 96 } 97 98 inline const char **EnumNamesAny() { 99 static const char *names[] = { 100 "NONE", 101 "Monster", 102 "TestSimpleTableWithEnum", 103 "MyGame_Example2_Monster", 104 nullptr 105 }; 106 return names; 107 } 108 109 inline const char *EnumNameAny(Any e) { 110 const size_t index = static_cast<int>(e); 111 return EnumNamesAny()[index]; 112 } 113 114 template<typename T> struct AnyTraits { 115 static const Any enum_value = Any_NONE; 116 }; 117 118 template<> struct AnyTraits<Monster> { 119 static const Any enum_value = Any_Monster; 120 }; 121 122 template<> struct AnyTraits<TestSimpleTableWithEnum> { 123 static const Any enum_value = Any_TestSimpleTableWithEnum; 124 }; 125 126 template<> struct AnyTraits<MyGame::Example2::Monster> { 127 static const Any enum_value = Any_MyGame_Example2_Monster; 128 }; 129 130 struct AnyUnion { 131 Any type; 132 void *value; 133 134 AnyUnion() : type(Any_NONE), value(nullptr) {} 135 AnyUnion(AnyUnion&& u) FLATBUFFERS_NOEXCEPT : 136 type(Any_NONE), value(nullptr) 137 { std::swap(type, u.type); std::swap(value, u.value); } 138 AnyUnion(const AnyUnion &) FLATBUFFERS_NOEXCEPT; 139 AnyUnion &operator=(const AnyUnion &u) FLATBUFFERS_NOEXCEPT 140 { AnyUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; } 141 AnyUnion &operator=(AnyUnion &&u) FLATBUFFERS_NOEXCEPT 142 { std::swap(type, u.type); std::swap(value, u.value); return *this; } 143 ~AnyUnion() { Reset(); } 144 145 void Reset(); 146 147 #ifndef FLATBUFFERS_CPP98_STL 148 template <typename T> 149 void Set(T&& val) { 150 Reset(); 151 type = AnyTraits<typename T::TableType>::enum_value; 152 if (type != Any_NONE) { 153 value = new T(std::forward<T>(val)); 154 } 155 } 156 #endif // FLATBUFFERS_CPP98_STL 157 158 static void *UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver); 159 flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const; 160 161 MonsterT *AsMonster() { 162 return type == Any_Monster ? 163 reinterpret_cast<MonsterT *>(value) : nullptr; 164 } 165 const MonsterT *AsMonster() const { 166 return type == Any_Monster ? 167 reinterpret_cast<const MonsterT *>(value) : nullptr; 168 } 169 TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() { 170 return type == Any_TestSimpleTableWithEnum ? 171 reinterpret_cast<TestSimpleTableWithEnumT *>(value) : nullptr; 172 } 173 const TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() const { 174 return type == Any_TestSimpleTableWithEnum ? 175 reinterpret_cast<const TestSimpleTableWithEnumT *>(value) : nullptr; 176 } 177 MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() { 178 return type == Any_MyGame_Example2_Monster ? 179 reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr; 180 } 181 const MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() const { 182 return type == Any_MyGame_Example2_Monster ? 183 reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr; 184 } 185 }; 186 187 bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type); 188 bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types); 189 190 MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS { 191 private: 192 int16_t a_; 193 int8_t b_; 194 int8_t padding0__; 195 196 public: 197 Test() { 198 memset(this, 0, sizeof(Test)); 199 } 200 Test(int16_t _a, int8_t _b) 201 : a_(flatbuffers::EndianScalar(_a)), 202 b_(flatbuffers::EndianScalar(_b)), 203 padding0__(0) { 204 (void)padding0__; 205 } 206 int16_t a() const { 207 return flatbuffers::EndianScalar(a_); 208 } 209 void mutate_a(int16_t _a) { 210 flatbuffers::WriteScalar(&a_, _a); 211 } 212 int8_t b() const { 213 return flatbuffers::EndianScalar(b_); 214 } 215 void mutate_b(int8_t _b) { 216 flatbuffers::WriteScalar(&b_, _b); 217 } 218 }; 219 STRUCT_END(Test, 4); 220 221 MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS { 222 private: 223 float x_; 224 float y_; 225 float z_; 226 int32_t padding0__; 227 double test1_; 228 int8_t test2_; 229 int8_t padding1__; 230 Test test3_; 231 int16_t padding2__; 232 233 public: 234 Vec3() { 235 memset(this, 0, sizeof(Vec3)); 236 } 237 Vec3(float _x, float _y, float _z, double _test1, Color _test2, const Test &_test3) 238 : x_(flatbuffers::EndianScalar(_x)), 239 y_(flatbuffers::EndianScalar(_y)), 240 z_(flatbuffers::EndianScalar(_z)), 241 padding0__(0), 242 test1_(flatbuffers::EndianScalar(_test1)), 243 test2_(flatbuffers::EndianScalar(static_cast<int8_t>(_test2))), 244 padding1__(0), 245 test3_(_test3), 246 padding2__(0) { 247 (void)padding0__; 248 (void)padding1__; 249 (void)padding2__; 250 } 251 float x() const { 252 return flatbuffers::EndianScalar(x_); 253 } 254 void mutate_x(float _x) { 255 flatbuffers::WriteScalar(&x_, _x); 256 } 257 float y() const { 258 return flatbuffers::EndianScalar(y_); 259 } 260 void mutate_y(float _y) { 261 flatbuffers::WriteScalar(&y_, _y); 262 } 263 float z() const { 264 return flatbuffers::EndianScalar(z_); 265 } 266 void mutate_z(float _z) { 267 flatbuffers::WriteScalar(&z_, _z); 268 } 269 double test1() const { 270 return flatbuffers::EndianScalar(test1_); 271 } 272 void mutate_test1(double _test1) { 273 flatbuffers::WriteScalar(&test1_, _test1); 274 } 275 Color test2() const { 276 return static_cast<Color>(flatbuffers::EndianScalar(test2_)); 277 } 278 void mutate_test2(Color _test2) { 279 flatbuffers::WriteScalar(&test2_, static_cast<int8_t>(_test2)); 280 } 281 const Test &test3() const { 282 return test3_; 283 } 284 Test &mutable_test3() { 285 return test3_; 286 } 287 }; 288 STRUCT_END(Vec3, 32); 289 290 MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS { 291 private: 292 uint32_t id_; 293 uint32_t distance_; 294 295 public: 296 Ability() { 297 memset(this, 0, sizeof(Ability)); 298 } 299 Ability(uint32_t _id, uint32_t _distance) 300 : id_(flatbuffers::EndianScalar(_id)), 301 distance_(flatbuffers::EndianScalar(_distance)) { 302 } 303 uint32_t id() const { 304 return flatbuffers::EndianScalar(id_); 305 } 306 void mutate_id(uint32_t _id) { 307 flatbuffers::WriteScalar(&id_, _id); 308 } 309 bool KeyCompareLessThan(const Ability *o) const { 310 return id() < o->id(); 311 } 312 int KeyCompareWithValue(uint32_t val) const { 313 const auto key = id(); 314 return static_cast<int>(key > val) - static_cast<int>(key < val); 315 } 316 uint32_t distance() const { 317 return flatbuffers::EndianScalar(distance_); 318 } 319 void mutate_distance(uint32_t _distance) { 320 flatbuffers::WriteScalar(&distance_, _distance); 321 } 322 }; 323 STRUCT_END(Ability, 8); 324 325 } // namespace Example 326 327 struct InParentNamespaceT : public flatbuffers::NativeTable { 328 typedef InParentNamespace TableType; 329 InParentNamespaceT() { 330 } 331 }; 332 333 struct InParentNamespace FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 334 typedef InParentNamespaceT NativeTableType; 335 bool Verify(flatbuffers::Verifier &verifier) const { 336 return VerifyTableStart(verifier) && 337 verifier.EndTable(); 338 } 339 InParentNamespaceT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 340 void UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 341 static flatbuffers::Offset<InParentNamespace> Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 342 }; 343 344 struct InParentNamespaceBuilder { 345 flatbuffers::FlatBufferBuilder &fbb_; 346 flatbuffers::uoffset_t start_; 347 explicit InParentNamespaceBuilder(flatbuffers::FlatBufferBuilder &_fbb) 348 : fbb_(_fbb) { 349 start_ = fbb_.StartTable(); 350 } 351 InParentNamespaceBuilder &operator=(const InParentNamespaceBuilder &); 352 flatbuffers::Offset<InParentNamespace> Finish() { 353 const auto end = fbb_.EndTable(start_); 354 auto o = flatbuffers::Offset<InParentNamespace>(end); 355 return o; 356 } 357 }; 358 359 inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace( 360 flatbuffers::FlatBufferBuilder &_fbb) { 361 InParentNamespaceBuilder builder_(_fbb); 362 return builder_.Finish(); 363 } 364 365 flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 366 367 namespace Example2 { 368 369 struct MonsterT : public flatbuffers::NativeTable { 370 typedef Monster TableType; 371 MonsterT() { 372 } 373 }; 374 375 struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 376 typedef MonsterT NativeTableType; 377 bool Verify(flatbuffers::Verifier &verifier) const { 378 return VerifyTableStart(verifier) && 379 verifier.EndTable(); 380 } 381 MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 382 void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 383 static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 384 }; 385 386 struct MonsterBuilder { 387 flatbuffers::FlatBufferBuilder &fbb_; 388 flatbuffers::uoffset_t start_; 389 explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) 390 : fbb_(_fbb) { 391 start_ = fbb_.StartTable(); 392 } 393 MonsterBuilder &operator=(const MonsterBuilder &); 394 flatbuffers::Offset<Monster> Finish() { 395 const auto end = fbb_.EndTable(start_); 396 auto o = flatbuffers::Offset<Monster>(end); 397 return o; 398 } 399 }; 400 401 inline flatbuffers::Offset<Monster> CreateMonster( 402 flatbuffers::FlatBufferBuilder &_fbb) { 403 MonsterBuilder builder_(_fbb); 404 return builder_.Finish(); 405 } 406 407 flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 408 409 } // namespace Example2 410 411 namespace Example { 412 413 struct TestSimpleTableWithEnumT : public flatbuffers::NativeTable { 414 typedef TestSimpleTableWithEnum TableType; 415 Color color; 416 TestSimpleTableWithEnumT() 417 : color(Color_Green) { 418 } 419 }; 420 421 struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 422 typedef TestSimpleTableWithEnumT NativeTableType; 423 enum { 424 VT_COLOR = 4 425 }; 426 Color color() const { 427 return static_cast<Color>(GetField<int8_t>(VT_COLOR, 2)); 428 } 429 bool mutate_color(Color _color) { 430 return SetField<int8_t>(VT_COLOR, static_cast<int8_t>(_color), 2); 431 } 432 bool Verify(flatbuffers::Verifier &verifier) const { 433 return VerifyTableStart(verifier) && 434 VerifyField<int8_t>(verifier, VT_COLOR) && 435 verifier.EndTable(); 436 } 437 TestSimpleTableWithEnumT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 438 void UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 439 static flatbuffers::Offset<TestSimpleTableWithEnum> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 440 }; 441 442 struct TestSimpleTableWithEnumBuilder { 443 flatbuffers::FlatBufferBuilder &fbb_; 444 flatbuffers::uoffset_t start_; 445 void add_color(Color color) { 446 fbb_.AddElement<int8_t>(TestSimpleTableWithEnum::VT_COLOR, static_cast<int8_t>(color), 2); 447 } 448 explicit TestSimpleTableWithEnumBuilder(flatbuffers::FlatBufferBuilder &_fbb) 449 : fbb_(_fbb) { 450 start_ = fbb_.StartTable(); 451 } 452 TestSimpleTableWithEnumBuilder &operator=(const TestSimpleTableWithEnumBuilder &); 453 flatbuffers::Offset<TestSimpleTableWithEnum> Finish() { 454 const auto end = fbb_.EndTable(start_); 455 auto o = flatbuffers::Offset<TestSimpleTableWithEnum>(end); 456 return o; 457 } 458 }; 459 460 inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum( 461 flatbuffers::FlatBufferBuilder &_fbb, 462 Color color = Color_Green) { 463 TestSimpleTableWithEnumBuilder builder_(_fbb); 464 builder_.add_color(color); 465 return builder_.Finish(); 466 } 467 468 flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 469 470 struct StatT : public flatbuffers::NativeTable { 471 typedef Stat TableType; 472 std::string id; 473 int64_t val; 474 uint16_t count; 475 StatT() 476 : val(0), 477 count(0) { 478 } 479 }; 480 481 struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 482 typedef StatT NativeTableType; 483 enum { 484 VT_ID = 4, 485 VT_VAL = 6, 486 VT_COUNT = 8 487 }; 488 const flatbuffers::String *id() const { 489 return GetPointer<const flatbuffers::String *>(VT_ID); 490 } 491 flatbuffers::String *mutable_id() { 492 return GetPointer<flatbuffers::String *>(VT_ID); 493 } 494 int64_t val() const { 495 return GetField<int64_t>(VT_VAL, 0); 496 } 497 bool mutate_val(int64_t _val) { 498 return SetField<int64_t>(VT_VAL, _val, 0); 499 } 500 uint16_t count() const { 501 return GetField<uint16_t>(VT_COUNT, 0); 502 } 503 bool mutate_count(uint16_t _count) { 504 return SetField<uint16_t>(VT_COUNT, _count, 0); 505 } 506 bool Verify(flatbuffers::Verifier &verifier) const { 507 return VerifyTableStart(verifier) && 508 VerifyOffset(verifier, VT_ID) && 509 verifier.Verify(id()) && 510 VerifyField<int64_t>(verifier, VT_VAL) && 511 VerifyField<uint16_t>(verifier, VT_COUNT) && 512 verifier.EndTable(); 513 } 514 StatT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 515 void UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 516 static flatbuffers::Offset<Stat> Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 517 }; 518 519 struct StatBuilder { 520 flatbuffers::FlatBufferBuilder &fbb_; 521 flatbuffers::uoffset_t start_; 522 void add_id(flatbuffers::Offset<flatbuffers::String> id) { 523 fbb_.AddOffset(Stat::VT_ID, id); 524 } 525 void add_val(int64_t val) { 526 fbb_.AddElement<int64_t>(Stat::VT_VAL, val, 0); 527 } 528 void add_count(uint16_t count) { 529 fbb_.AddElement<uint16_t>(Stat::VT_COUNT, count, 0); 530 } 531 explicit StatBuilder(flatbuffers::FlatBufferBuilder &_fbb) 532 : fbb_(_fbb) { 533 start_ = fbb_.StartTable(); 534 } 535 StatBuilder &operator=(const StatBuilder &); 536 flatbuffers::Offset<Stat> Finish() { 537 const auto end = fbb_.EndTable(start_); 538 auto o = flatbuffers::Offset<Stat>(end); 539 return o; 540 } 541 }; 542 543 inline flatbuffers::Offset<Stat> CreateStat( 544 flatbuffers::FlatBufferBuilder &_fbb, 545 flatbuffers::Offset<flatbuffers::String> id = 0, 546 int64_t val = 0, 547 uint16_t count = 0) { 548 StatBuilder builder_(_fbb); 549 builder_.add_val(val); 550 builder_.add_id(id); 551 builder_.add_count(count); 552 return builder_.Finish(); 553 } 554 555 inline flatbuffers::Offset<Stat> CreateStatDirect( 556 flatbuffers::FlatBufferBuilder &_fbb, 557 const char *id = nullptr, 558 int64_t val = 0, 559 uint16_t count = 0) { 560 return MyGame::Example::CreateStat( 561 _fbb, 562 id ? _fbb.CreateString(id) : 0, 563 val, 564 count); 565 } 566 567 flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 568 569 struct MonsterT : public flatbuffers::NativeTable { 570 typedef Monster TableType; 571 flatbuffers::unique_ptr<Vec3> pos; 572 int16_t mana; 573 int16_t hp; 574 std::string name; 575 std::vector<uint8_t> inventory; 576 Color color; 577 AnyUnion test; 578 std::vector<Test> test4; 579 std::vector<std::string> testarrayofstring; 580 std::vector<flatbuffers::unique_ptr<MonsterT>> testarrayoftables; 581 flatbuffers::unique_ptr<MonsterT> enemy; 582 std::vector<uint8_t> testnestedflatbuffer; 583 flatbuffers::unique_ptr<StatT> testempty; 584 bool testbool; 585 int32_t testhashs32_fnv1; 586 uint32_t testhashu32_fnv1; 587 int64_t testhashs64_fnv1; 588 uint64_t testhashu64_fnv1; 589 int32_t testhashs32_fnv1a; 590 Stat *testhashu32_fnv1a; 591 int64_t testhashs64_fnv1a; 592 uint64_t testhashu64_fnv1a; 593 std::vector<bool> testarrayofbools; 594 float testf; 595 float testf2; 596 float testf3; 597 std::vector<std::string> testarrayofstring2; 598 std::vector<Ability> testarrayofsortedstruct; 599 std::vector<uint8_t> flex; 600 std::vector<Test> test5; 601 std::vector<int64_t> vector_of_longs; 602 std::vector<double> vector_of_doubles; 603 flatbuffers::unique_ptr<MyGame::InParentNamespaceT> parent_namespace_test; 604 MonsterT() 605 : mana(150), 606 hp(100), 607 color(Color_Blue), 608 testbool(false), 609 testhashs32_fnv1(0), 610 testhashu32_fnv1(0), 611 testhashs64_fnv1(0), 612 testhashu64_fnv1(0), 613 testhashs32_fnv1a(0), 614 testhashu32_fnv1a(0), 615 testhashs64_fnv1a(0), 616 testhashu64_fnv1a(0), 617 testf(3.14159f), 618 testf2(3.0f), 619 testf3(0.0f) { 620 } 621 }; 622 623 /// an example documentation comment: monster object 624 struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 625 typedef MonsterT NativeTableType; 626 enum { 627 VT_POS = 4, 628 VT_MANA = 6, 629 VT_HP = 8, 630 VT_NAME = 10, 631 VT_INVENTORY = 14, 632 VT_COLOR = 16, 633 VT_TEST_TYPE = 18, 634 VT_TEST = 20, 635 VT_TEST4 = 22, 636 VT_TESTARRAYOFSTRING = 24, 637 VT_TESTARRAYOFTABLES = 26, 638 VT_ENEMY = 28, 639 VT_TESTNESTEDFLATBUFFER = 30, 640 VT_TESTEMPTY = 32, 641 VT_TESTBOOL = 34, 642 VT_TESTHASHS32_FNV1 = 36, 643 VT_TESTHASHU32_FNV1 = 38, 644 VT_TESTHASHS64_FNV1 = 40, 645 VT_TESTHASHU64_FNV1 = 42, 646 VT_TESTHASHS32_FNV1A = 44, 647 VT_TESTHASHU32_FNV1A = 46, 648 VT_TESTHASHS64_FNV1A = 48, 649 VT_TESTHASHU64_FNV1A = 50, 650 VT_TESTARRAYOFBOOLS = 52, 651 VT_TESTF = 54, 652 VT_TESTF2 = 56, 653 VT_TESTF3 = 58, 654 VT_TESTARRAYOFSTRING2 = 60, 655 VT_TESTARRAYOFSORTEDSTRUCT = 62, 656 VT_FLEX = 64, 657 VT_TEST5 = 66, 658 VT_VECTOR_OF_LONGS = 68, 659 VT_VECTOR_OF_DOUBLES = 70, 660 VT_PARENT_NAMESPACE_TEST = 72 661 }; 662 const Vec3 *pos() const { 663 return GetStruct<const Vec3 *>(VT_POS); 664 } 665 Vec3 *mutable_pos() { 666 return GetStruct<Vec3 *>(VT_POS); 667 } 668 int16_t mana() const { 669 return GetField<int16_t>(VT_MANA, 150); 670 } 671 bool mutate_mana(int16_t _mana) { 672 return SetField<int16_t>(VT_MANA, _mana, 150); 673 } 674 int16_t hp() const { 675 return GetField<int16_t>(VT_HP, 100); 676 } 677 bool mutate_hp(int16_t _hp) { 678 return SetField<int16_t>(VT_HP, _hp, 100); 679 } 680 const flatbuffers::String *name() const { 681 return GetPointer<const flatbuffers::String *>(VT_NAME); 682 } 683 flatbuffers::String *mutable_name() { 684 return GetPointer<flatbuffers::String *>(VT_NAME); 685 } 686 bool KeyCompareLessThan(const Monster *o) const { 687 return *name() < *o->name(); 688 } 689 int KeyCompareWithValue(const char *val) const { 690 return strcmp(name()->c_str(), val); 691 } 692 const flatbuffers::Vector<uint8_t> *inventory() const { 693 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_INVENTORY); 694 } 695 flatbuffers::Vector<uint8_t> *mutable_inventory() { 696 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_INVENTORY); 697 } 698 Color color() const { 699 return static_cast<Color>(GetField<int8_t>(VT_COLOR, 8)); 700 } 701 bool mutate_color(Color _color) { 702 return SetField<int8_t>(VT_COLOR, static_cast<int8_t>(_color), 8); 703 } 704 Any test_type() const { 705 return static_cast<Any>(GetField<uint8_t>(VT_TEST_TYPE, 0)); 706 } 707 bool mutate_test_type(Any _test_type) { 708 return SetField<uint8_t>(VT_TEST_TYPE, static_cast<uint8_t>(_test_type), 0); 709 } 710 const void *test() const { 711 return GetPointer<const void *>(VT_TEST); 712 } 713 template<typename T> const T *test_as() const; 714 const Monster *test_as_Monster() const { 715 return test_type() == Any_Monster ? static_cast<const Monster *>(test()) : nullptr; 716 } 717 const TestSimpleTableWithEnum *test_as_TestSimpleTableWithEnum() const { 718 return test_type() == Any_TestSimpleTableWithEnum ? static_cast<const TestSimpleTableWithEnum *>(test()) : nullptr; 719 } 720 const MyGame::Example2::Monster *test_as_MyGame_Example2_Monster() const { 721 return test_type() == Any_MyGame_Example2_Monster ? static_cast<const MyGame::Example2::Monster *>(test()) : nullptr; 722 } 723 void *mutable_test() { 724 return GetPointer<void *>(VT_TEST); 725 } 726 const flatbuffers::Vector<const Test *> *test4() const { 727 return GetPointer<const flatbuffers::Vector<const Test *> *>(VT_TEST4); 728 } 729 flatbuffers::Vector<const Test *> *mutable_test4() { 730 return GetPointer<flatbuffers::Vector<const Test *> *>(VT_TEST4); 731 } 732 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring() const { 733 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING); 734 } 735 flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring() { 736 return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING); 737 } 738 /// an example documentation comment: this will end up in the generated code 739 /// multiline too 740 const flatbuffers::Vector<flatbuffers::Offset<Monster>> *testarrayoftables() const { 741 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Monster>> *>(VT_TESTARRAYOFTABLES); 742 } 743 flatbuffers::Vector<flatbuffers::Offset<Monster>> *mutable_testarrayoftables() { 744 return GetPointer<flatbuffers::Vector<flatbuffers::Offset<Monster>> *>(VT_TESTARRAYOFTABLES); 745 } 746 const Monster *enemy() const { 747 return GetPointer<const Monster *>(VT_ENEMY); 748 } 749 Monster *mutable_enemy() { 750 return GetPointer<Monster *>(VT_ENEMY); 751 } 752 const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const { 753 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER); 754 } 755 flatbuffers::Vector<uint8_t> *mutable_testnestedflatbuffer() { 756 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER); 757 } 758 const MyGame::Example::Monster *testnestedflatbuffer_nested_root() const { 759 auto data = testnestedflatbuffer()->Data(); 760 return flatbuffers::GetRoot<MyGame::Example::Monster>(data); 761 } 762 const Stat *testempty() const { 763 return GetPointer<const Stat *>(VT_TESTEMPTY); 764 } 765 Stat *mutable_testempty() { 766 return GetPointer<Stat *>(VT_TESTEMPTY); 767 } 768 bool testbool() const { 769 return GetField<uint8_t>(VT_TESTBOOL, 0) != 0; 770 } 771 bool mutate_testbool(bool _testbool) { 772 return SetField<uint8_t>(VT_TESTBOOL, static_cast<uint8_t>(_testbool), 0); 773 } 774 int32_t testhashs32_fnv1() const { 775 return GetField<int32_t>(VT_TESTHASHS32_FNV1, 0); 776 } 777 bool mutate_testhashs32_fnv1(int32_t _testhashs32_fnv1) { 778 return SetField<int32_t>(VT_TESTHASHS32_FNV1, _testhashs32_fnv1, 0); 779 } 780 uint32_t testhashu32_fnv1() const { 781 return GetField<uint32_t>(VT_TESTHASHU32_FNV1, 0); 782 } 783 bool mutate_testhashu32_fnv1(uint32_t _testhashu32_fnv1) { 784 return SetField<uint32_t>(VT_TESTHASHU32_FNV1, _testhashu32_fnv1, 0); 785 } 786 int64_t testhashs64_fnv1() const { 787 return GetField<int64_t>(VT_TESTHASHS64_FNV1, 0); 788 } 789 bool mutate_testhashs64_fnv1(int64_t _testhashs64_fnv1) { 790 return SetField<int64_t>(VT_TESTHASHS64_FNV1, _testhashs64_fnv1, 0); 791 } 792 uint64_t testhashu64_fnv1() const { 793 return GetField<uint64_t>(VT_TESTHASHU64_FNV1, 0); 794 } 795 bool mutate_testhashu64_fnv1(uint64_t _testhashu64_fnv1) { 796 return SetField<uint64_t>(VT_TESTHASHU64_FNV1, _testhashu64_fnv1, 0); 797 } 798 int32_t testhashs32_fnv1a() const { 799 return GetField<int32_t>(VT_TESTHASHS32_FNV1A, 0); 800 } 801 bool mutate_testhashs32_fnv1a(int32_t _testhashs32_fnv1a) { 802 return SetField<int32_t>(VT_TESTHASHS32_FNV1A, _testhashs32_fnv1a, 0); 803 } 804 uint32_t testhashu32_fnv1a() const { 805 return GetField<uint32_t>(VT_TESTHASHU32_FNV1A, 0); 806 } 807 bool mutate_testhashu32_fnv1a(uint32_t _testhashu32_fnv1a) { 808 return SetField<uint32_t>(VT_TESTHASHU32_FNV1A, _testhashu32_fnv1a, 0); 809 } 810 int64_t testhashs64_fnv1a() const { 811 return GetField<int64_t>(VT_TESTHASHS64_FNV1A, 0); 812 } 813 bool mutate_testhashs64_fnv1a(int64_t _testhashs64_fnv1a) { 814 return SetField<int64_t>(VT_TESTHASHS64_FNV1A, _testhashs64_fnv1a, 0); 815 } 816 uint64_t testhashu64_fnv1a() const { 817 return GetField<uint64_t>(VT_TESTHASHU64_FNV1A, 0); 818 } 819 bool mutate_testhashu64_fnv1a(uint64_t _testhashu64_fnv1a) { 820 return SetField<uint64_t>(VT_TESTHASHU64_FNV1A, _testhashu64_fnv1a, 0); 821 } 822 const flatbuffers::Vector<uint8_t> *testarrayofbools() const { 823 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS); 824 } 825 flatbuffers::Vector<uint8_t> *mutable_testarrayofbools() { 826 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS); 827 } 828 float testf() const { 829 return GetField<float>(VT_TESTF, 3.14159f); 830 } 831 bool mutate_testf(float _testf) { 832 return SetField<float>(VT_TESTF, _testf, 3.14159f); 833 } 834 float testf2() const { 835 return GetField<float>(VT_TESTF2, 3.0f); 836 } 837 bool mutate_testf2(float _testf2) { 838 return SetField<float>(VT_TESTF2, _testf2, 3.0f); 839 } 840 float testf3() const { 841 return GetField<float>(VT_TESTF3, 0.0f); 842 } 843 bool mutate_testf3(float _testf3) { 844 return SetField<float>(VT_TESTF3, _testf3, 0.0f); 845 } 846 const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2() const { 847 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2); 848 } 849 flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring2() { 850 return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2); 851 } 852 const flatbuffers::Vector<const Ability *> *testarrayofsortedstruct() const { 853 return GetPointer<const flatbuffers::Vector<const Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT); 854 } 855 flatbuffers::Vector<const Ability *> *mutable_testarrayofsortedstruct() { 856 return GetPointer<flatbuffers::Vector<const Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT); 857 } 858 const flatbuffers::Vector<uint8_t> *flex() const { 859 return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_FLEX); 860 } 861 flatbuffers::Vector<uint8_t> *mutable_flex() { 862 return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_FLEX); 863 } 864 flexbuffers::Reference flex_flexbuffer_root() const { 865 auto v = flex(); 866 return flexbuffers::GetRoot(v->Data(), v->size()); 867 } 868 const flatbuffers::Vector<const Test *> *test5() const { 869 return GetPointer<const flatbuffers::Vector<const Test *> *>(VT_TEST5); 870 } 871 flatbuffers::Vector<const Test *> *mutable_test5() { 872 return GetPointer<flatbuffers::Vector<const Test *> *>(VT_TEST5); 873 } 874 const flatbuffers::Vector<int64_t> *vector_of_longs() const { 875 return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS); 876 } 877 flatbuffers::Vector<int64_t> *mutable_vector_of_longs() { 878 return GetPointer<flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS); 879 } 880 const flatbuffers::Vector<double> *vector_of_doubles() const { 881 return GetPointer<const flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES); 882 } 883 flatbuffers::Vector<double> *mutable_vector_of_doubles() { 884 return GetPointer<flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES); 885 } 886 const MyGame::InParentNamespace *parent_namespace_test() const { 887 return GetPointer<const MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST); 888 } 889 MyGame::InParentNamespace *mutable_parent_namespace_test() { 890 return GetPointer<MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST); 891 } 892 bool Verify(flatbuffers::Verifier &verifier) const { 893 return VerifyTableStart(verifier) && 894 VerifyField<Vec3>(verifier, VT_POS) && 895 VerifyField<int16_t>(verifier, VT_MANA) && 896 VerifyField<int16_t>(verifier, VT_HP) && 897 VerifyOffsetRequired(verifier, VT_NAME) && 898 verifier.Verify(name()) && 899 VerifyOffset(verifier, VT_INVENTORY) && 900 verifier.Verify(inventory()) && 901 VerifyField<int8_t>(verifier, VT_COLOR) && 902 VerifyField<uint8_t>(verifier, VT_TEST_TYPE) && 903 VerifyOffset(verifier, VT_TEST) && 904 VerifyAny(verifier, test(), test_type()) && 905 VerifyOffset(verifier, VT_TEST4) && 906 verifier.Verify(test4()) && 907 VerifyOffset(verifier, VT_TESTARRAYOFSTRING) && 908 verifier.Verify(testarrayofstring()) && 909 verifier.VerifyVectorOfStrings(testarrayofstring()) && 910 VerifyOffset(verifier, VT_TESTARRAYOFTABLES) && 911 verifier.Verify(testarrayoftables()) && 912 verifier.VerifyVectorOfTables(testarrayoftables()) && 913 VerifyOffset(verifier, VT_ENEMY) && 914 verifier.VerifyTable(enemy()) && 915 VerifyOffset(verifier, VT_TESTNESTEDFLATBUFFER) && 916 verifier.Verify(testnestedflatbuffer()) && 917 VerifyOffset(verifier, VT_TESTEMPTY) && 918 verifier.VerifyTable(testempty()) && 919 VerifyField<uint8_t>(verifier, VT_TESTBOOL) && 920 VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1) && 921 VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1) && 922 VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1) && 923 VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1) && 924 VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1A) && 925 VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1A) && 926 VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1A) && 927 VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1A) && 928 VerifyOffset(verifier, VT_TESTARRAYOFBOOLS) && 929 verifier.Verify(testarrayofbools()) && 930 VerifyField<float>(verifier, VT_TESTF) && 931 VerifyField<float>(verifier, VT_TESTF2) && 932 VerifyField<float>(verifier, VT_TESTF3) && 933 VerifyOffset(verifier, VT_TESTARRAYOFSTRING2) && 934 verifier.Verify(testarrayofstring2()) && 935 verifier.VerifyVectorOfStrings(testarrayofstring2()) && 936 VerifyOffset(verifier, VT_TESTARRAYOFSORTEDSTRUCT) && 937 verifier.Verify(testarrayofsortedstruct()) && 938 VerifyOffset(verifier, VT_FLEX) && 939 verifier.Verify(flex()) && 940 VerifyOffset(verifier, VT_TEST5) && 941 verifier.Verify(test5()) && 942 VerifyOffset(verifier, VT_VECTOR_OF_LONGS) && 943 verifier.Verify(vector_of_longs()) && 944 VerifyOffset(verifier, VT_VECTOR_OF_DOUBLES) && 945 verifier.Verify(vector_of_doubles()) && 946 VerifyOffset(verifier, VT_PARENT_NAMESPACE_TEST) && 947 verifier.VerifyTable(parent_namespace_test()) && 948 verifier.EndTable(); 949 } 950 MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 951 void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 952 static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 953 }; 954 955 template<> inline const Monster *Monster::test_as<Monster>() const { 956 return test_as_Monster(); 957 } 958 959 template<> inline const TestSimpleTableWithEnum *Monster::test_as<TestSimpleTableWithEnum>() const { 960 return test_as_TestSimpleTableWithEnum(); 961 } 962 963 template<> inline const MyGame::Example2::Monster *Monster::test_as<MyGame::Example2::Monster>() const { 964 return test_as_MyGame_Example2_Monster(); 965 } 966 967 struct MonsterBuilder { 968 flatbuffers::FlatBufferBuilder &fbb_; 969 flatbuffers::uoffset_t start_; 970 void add_pos(const Vec3 *pos) { 971 fbb_.AddStruct(Monster::VT_POS, pos); 972 } 973 void add_mana(int16_t mana) { 974 fbb_.AddElement<int16_t>(Monster::VT_MANA, mana, 150); 975 } 976 void add_hp(int16_t hp) { 977 fbb_.AddElement<int16_t>(Monster::VT_HP, hp, 100); 978 } 979 void add_name(flatbuffers::Offset<flatbuffers::String> name) { 980 fbb_.AddOffset(Monster::VT_NAME, name); 981 } 982 void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) { 983 fbb_.AddOffset(Monster::VT_INVENTORY, inventory); 984 } 985 void add_color(Color color) { 986 fbb_.AddElement<int8_t>(Monster::VT_COLOR, static_cast<int8_t>(color), 8); 987 } 988 void add_test_type(Any test_type) { 989 fbb_.AddElement<uint8_t>(Monster::VT_TEST_TYPE, static_cast<uint8_t>(test_type), 0); 990 } 991 void add_test(flatbuffers::Offset<void> test) { 992 fbb_.AddOffset(Monster::VT_TEST, test); 993 } 994 void add_test4(flatbuffers::Offset<flatbuffers::Vector<const Test *>> test4) { 995 fbb_.AddOffset(Monster::VT_TEST4, test4); 996 } 997 void add_testarrayofstring(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring) { 998 fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING, testarrayofstring); 999 } 1000 void add_testarrayoftables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables) { 1001 fbb_.AddOffset(Monster::VT_TESTARRAYOFTABLES, testarrayoftables); 1002 } 1003 void add_enemy(flatbuffers::Offset<Monster> enemy) { 1004 fbb_.AddOffset(Monster::VT_ENEMY, enemy); 1005 } 1006 void add_testnestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer) { 1007 fbb_.AddOffset(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer); 1008 } 1009 void add_testempty(flatbuffers::Offset<Stat> testempty) { 1010 fbb_.AddOffset(Monster::VT_TESTEMPTY, testempty); 1011 } 1012 void add_testbool(bool testbool) { 1013 fbb_.AddElement<uint8_t>(Monster::VT_TESTBOOL, static_cast<uint8_t>(testbool), 0); 1014 } 1015 void add_testhashs32_fnv1(int32_t testhashs32_fnv1) { 1016 fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0); 1017 } 1018 void add_testhashu32_fnv1(uint32_t testhashu32_fnv1) { 1019 fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0); 1020 } 1021 void add_testhashs64_fnv1(int64_t testhashs64_fnv1) { 1022 fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0); 1023 } 1024 void add_testhashu64_fnv1(uint64_t testhashu64_fnv1) { 1025 fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0); 1026 } 1027 void add_testhashs32_fnv1a(int32_t testhashs32_fnv1a) { 1028 fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0); 1029 } 1030 void add_testhashu32_fnv1a(uint32_t testhashu32_fnv1a) { 1031 fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0); 1032 } 1033 void add_testhashs64_fnv1a(int64_t testhashs64_fnv1a) { 1034 fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0); 1035 } 1036 void add_testhashu64_fnv1a(uint64_t testhashu64_fnv1a) { 1037 fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0); 1038 } 1039 void add_testarrayofbools(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools) { 1040 fbb_.AddOffset(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools); 1041 } 1042 void add_testf(float testf) { 1043 fbb_.AddElement<float>(Monster::VT_TESTF, testf, 3.14159f); 1044 } 1045 void add_testf2(float testf2) { 1046 fbb_.AddElement<float>(Monster::VT_TESTF2, testf2, 3.0f); 1047 } 1048 void add_testf3(float testf3) { 1049 fbb_.AddElement<float>(Monster::VT_TESTF3, testf3, 0.0f); 1050 } 1051 void add_testarrayofstring2(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2) { 1052 fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2); 1053 } 1054 void add_testarrayofsortedstruct(flatbuffers::Offset<flatbuffers::Vector<const Ability *>> testarrayofsortedstruct) { 1055 fbb_.AddOffset(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct); 1056 } 1057 void add_flex(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex) { 1058 fbb_.AddOffset(Monster::VT_FLEX, flex); 1059 } 1060 void add_test5(flatbuffers::Offset<flatbuffers::Vector<const Test *>> test5) { 1061 fbb_.AddOffset(Monster::VT_TEST5, test5); 1062 } 1063 void add_vector_of_longs(flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs) { 1064 fbb_.AddOffset(Monster::VT_VECTOR_OF_LONGS, vector_of_longs); 1065 } 1066 void add_vector_of_doubles(flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles) { 1067 fbb_.AddOffset(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles); 1068 } 1069 void add_parent_namespace_test(flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test) { 1070 fbb_.AddOffset(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test); 1071 } 1072 explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1073 : fbb_(_fbb) { 1074 start_ = fbb_.StartTable(); 1075 } 1076 MonsterBuilder &operator=(const MonsterBuilder &); 1077 flatbuffers::Offset<Monster> Finish() { 1078 const auto end = fbb_.EndTable(start_); 1079 auto o = flatbuffers::Offset<Monster>(end); 1080 fbb_.Required(o, Monster::VT_NAME); 1081 return o; 1082 } 1083 }; 1084 1085 inline flatbuffers::Offset<Monster> CreateMonster( 1086 flatbuffers::FlatBufferBuilder &_fbb, 1087 const Vec3 *pos = 0, 1088 int16_t mana = 150, 1089 int16_t hp = 100, 1090 flatbuffers::Offset<flatbuffers::String> name = 0, 1091 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory = 0, 1092 Color color = Color_Blue, 1093 Any test_type = Any_NONE, 1094 flatbuffers::Offset<void> test = 0, 1095 flatbuffers::Offset<flatbuffers::Vector<const Test *>> test4 = 0, 1096 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring = 0, 1097 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Monster>>> testarrayoftables = 0, 1098 flatbuffers::Offset<Monster> enemy = 0, 1099 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer = 0, 1100 flatbuffers::Offset<Stat> testempty = 0, 1101 bool testbool = false, 1102 int32_t testhashs32_fnv1 = 0, 1103 uint32_t testhashu32_fnv1 = 0, 1104 int64_t testhashs64_fnv1 = 0, 1105 uint64_t testhashu64_fnv1 = 0, 1106 int32_t testhashs32_fnv1a = 0, 1107 uint32_t testhashu32_fnv1a = 0, 1108 int64_t testhashs64_fnv1a = 0, 1109 uint64_t testhashu64_fnv1a = 0, 1110 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools = 0, 1111 float testf = 3.14159f, 1112 float testf2 = 3.0f, 1113 float testf3 = 0.0f, 1114 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2 = 0, 1115 flatbuffers::Offset<flatbuffers::Vector<const Ability *>> testarrayofsortedstruct = 0, 1116 flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex = 0, 1117 flatbuffers::Offset<flatbuffers::Vector<const Test *>> test5 = 0, 1118 flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs = 0, 1119 flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles = 0, 1120 flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0) { 1121 MonsterBuilder builder_(_fbb); 1122 builder_.add_testhashu64_fnv1a(testhashu64_fnv1a); 1123 builder_.add_testhashs64_fnv1a(testhashs64_fnv1a); 1124 builder_.add_testhashu64_fnv1(testhashu64_fnv1); 1125 builder_.add_testhashs64_fnv1(testhashs64_fnv1); 1126 builder_.add_parent_namespace_test(parent_namespace_test); 1127 builder_.add_vector_of_doubles(vector_of_doubles); 1128 builder_.add_vector_of_longs(vector_of_longs); 1129 builder_.add_test5(test5); 1130 builder_.add_flex(flex); 1131 builder_.add_testarrayofsortedstruct(testarrayofsortedstruct); 1132 builder_.add_testarrayofstring2(testarrayofstring2); 1133 builder_.add_testf3(testf3); 1134 builder_.add_testf2(testf2); 1135 builder_.add_testf(testf); 1136 builder_.add_testarrayofbools(testarrayofbools); 1137 builder_.add_testhashu32_fnv1a(testhashu32_fnv1a); 1138 builder_.add_testhashs32_fnv1a(testhashs32_fnv1a); 1139 builder_.add_testhashu32_fnv1(testhashu32_fnv1); 1140 builder_.add_testhashs32_fnv1(testhashs32_fnv1); 1141 builder_.add_testempty(testempty); 1142 builder_.add_testnestedflatbuffer(testnestedflatbuffer); 1143 builder_.add_enemy(enemy); 1144 builder_.add_testarrayoftables(testarrayoftables); 1145 builder_.add_testarrayofstring(testarrayofstring); 1146 builder_.add_test4(test4); 1147 builder_.add_test(test); 1148 builder_.add_inventory(inventory); 1149 builder_.add_name(name); 1150 builder_.add_pos(pos); 1151 builder_.add_hp(hp); 1152 builder_.add_mana(mana); 1153 builder_.add_testbool(testbool); 1154 builder_.add_test_type(test_type); 1155 builder_.add_color(color); 1156 return builder_.Finish(); 1157 } 1158 1159 inline flatbuffers::Offset<Monster> CreateMonsterDirect( 1160 flatbuffers::FlatBufferBuilder &_fbb, 1161 const Vec3 *pos = 0, 1162 int16_t mana = 150, 1163 int16_t hp = 100, 1164 const char *name = nullptr, 1165 const std::vector<uint8_t> *inventory = nullptr, 1166 Color color = Color_Blue, 1167 Any test_type = Any_NONE, 1168 flatbuffers::Offset<void> test = 0, 1169 const std::vector<const Test *> *test4 = nullptr, 1170 const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring = nullptr, 1171 const std::vector<flatbuffers::Offset<Monster>> *testarrayoftables = nullptr, 1172 flatbuffers::Offset<Monster> enemy = 0, 1173 const std::vector<uint8_t> *testnestedflatbuffer = nullptr, 1174 flatbuffers::Offset<Stat> testempty = 0, 1175 bool testbool = false, 1176 int32_t testhashs32_fnv1 = 0, 1177 uint32_t testhashu32_fnv1 = 0, 1178 int64_t testhashs64_fnv1 = 0, 1179 uint64_t testhashu64_fnv1 = 0, 1180 int32_t testhashs32_fnv1a = 0, 1181 uint32_t testhashu32_fnv1a = 0, 1182 int64_t testhashs64_fnv1a = 0, 1183 uint64_t testhashu64_fnv1a = 0, 1184 const std::vector<uint8_t> *testarrayofbools = nullptr, 1185 float testf = 3.14159f, 1186 float testf2 = 3.0f, 1187 float testf3 = 0.0f, 1188 const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2 = nullptr, 1189 const std::vector<const Ability *> *testarrayofsortedstruct = nullptr, 1190 const std::vector<uint8_t> *flex = nullptr, 1191 const std::vector<const Test *> *test5 = nullptr, 1192 const std::vector<int64_t> *vector_of_longs = nullptr, 1193 const std::vector<double> *vector_of_doubles = nullptr, 1194 flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0) { 1195 return MyGame::Example::CreateMonster( 1196 _fbb, 1197 pos, 1198 mana, 1199 hp, 1200 name ? _fbb.CreateString(name) : 0, 1201 inventory ? _fbb.CreateVector<uint8_t>(*inventory) : 0, 1202 color, 1203 test_type, 1204 test, 1205 test4 ? _fbb.CreateVector<const Test *>(*test4) : 0, 1206 testarrayofstring ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring) : 0, 1207 testarrayoftables ? _fbb.CreateVector<flatbuffers::Offset<Monster>>(*testarrayoftables) : 0, 1208 enemy, 1209 testnestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testnestedflatbuffer) : 0, 1210 testempty, 1211 testbool, 1212 testhashs32_fnv1, 1213 testhashu32_fnv1, 1214 testhashs64_fnv1, 1215 testhashu64_fnv1, 1216 testhashs32_fnv1a, 1217 testhashu32_fnv1a, 1218 testhashs64_fnv1a, 1219 testhashu64_fnv1a, 1220 testarrayofbools ? _fbb.CreateVector<uint8_t>(*testarrayofbools) : 0, 1221 testf, 1222 testf2, 1223 testf3, 1224 testarrayofstring2 ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring2) : 0, 1225 testarrayofsortedstruct ? _fbb.CreateVector<const Ability *>(*testarrayofsortedstruct) : 0, 1226 flex ? _fbb.CreateVector<uint8_t>(*flex) : 0, 1227 test5 ? _fbb.CreateVector<const Test *>(*test5) : 0, 1228 vector_of_longs ? _fbb.CreateVector<int64_t>(*vector_of_longs) : 0, 1229 vector_of_doubles ? _fbb.CreateVector<double>(*vector_of_doubles) : 0, 1230 parent_namespace_test); 1231 } 1232 1233 flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1234 1235 struct TypeAliasesT : public flatbuffers::NativeTable { 1236 typedef TypeAliases TableType; 1237 int8_t i8; 1238 uint8_t u8; 1239 int16_t i16; 1240 uint16_t u16; 1241 int32_t i32; 1242 uint32_t u32; 1243 int64_t i64; 1244 uint64_t u64; 1245 float f32; 1246 double f64; 1247 std::vector<int8_t> v8; 1248 std::vector<double> vf64; 1249 TypeAliasesT() 1250 : i8(0), 1251 u8(0), 1252 i16(0), 1253 u16(0), 1254 i32(0), 1255 u32(0), 1256 i64(0), 1257 u64(0), 1258 f32(0.0f), 1259 f64(0.0) { 1260 } 1261 }; 1262 1263 struct TypeAliases FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { 1264 typedef TypeAliasesT NativeTableType; 1265 enum { 1266 VT_I8 = 4, 1267 VT_U8 = 6, 1268 VT_I16 = 8, 1269 VT_U16 = 10, 1270 VT_I32 = 12, 1271 VT_U32 = 14, 1272 VT_I64 = 16, 1273 VT_U64 = 18, 1274 VT_F32 = 20, 1275 VT_F64 = 22, 1276 VT_V8 = 24, 1277 VT_VF64 = 26 1278 }; 1279 int8_t i8() const { 1280 return GetField<int8_t>(VT_I8, 0); 1281 } 1282 bool mutate_i8(int8_t _i8) { 1283 return SetField<int8_t>(VT_I8, _i8, 0); 1284 } 1285 uint8_t u8() const { 1286 return GetField<uint8_t>(VT_U8, 0); 1287 } 1288 bool mutate_u8(uint8_t _u8) { 1289 return SetField<uint8_t>(VT_U8, _u8, 0); 1290 } 1291 int16_t i16() const { 1292 return GetField<int16_t>(VT_I16, 0); 1293 } 1294 bool mutate_i16(int16_t _i16) { 1295 return SetField<int16_t>(VT_I16, _i16, 0); 1296 } 1297 uint16_t u16() const { 1298 return GetField<uint16_t>(VT_U16, 0); 1299 } 1300 bool mutate_u16(uint16_t _u16) { 1301 return SetField<uint16_t>(VT_U16, _u16, 0); 1302 } 1303 int32_t i32() const { 1304 return GetField<int32_t>(VT_I32, 0); 1305 } 1306 bool mutate_i32(int32_t _i32) { 1307 return SetField<int32_t>(VT_I32, _i32, 0); 1308 } 1309 uint32_t u32() const { 1310 return GetField<uint32_t>(VT_U32, 0); 1311 } 1312 bool mutate_u32(uint32_t _u32) { 1313 return SetField<uint32_t>(VT_U32, _u32, 0); 1314 } 1315 int64_t i64() const { 1316 return GetField<int64_t>(VT_I64, 0); 1317 } 1318 bool mutate_i64(int64_t _i64) { 1319 return SetField<int64_t>(VT_I64, _i64, 0); 1320 } 1321 uint64_t u64() const { 1322 return GetField<uint64_t>(VT_U64, 0); 1323 } 1324 bool mutate_u64(uint64_t _u64) { 1325 return SetField<uint64_t>(VT_U64, _u64, 0); 1326 } 1327 float f32() const { 1328 return GetField<float>(VT_F32, 0.0f); 1329 } 1330 bool mutate_f32(float _f32) { 1331 return SetField<float>(VT_F32, _f32, 0.0f); 1332 } 1333 double f64() const { 1334 return GetField<double>(VT_F64, 0.0); 1335 } 1336 bool mutate_f64(double _f64) { 1337 return SetField<double>(VT_F64, _f64, 0.0); 1338 } 1339 const flatbuffers::Vector<int8_t> *v8() const { 1340 return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_V8); 1341 } 1342 flatbuffers::Vector<int8_t> *mutable_v8() { 1343 return GetPointer<flatbuffers::Vector<int8_t> *>(VT_V8); 1344 } 1345 const flatbuffers::Vector<double> *vf64() const { 1346 return GetPointer<const flatbuffers::Vector<double> *>(VT_VF64); 1347 } 1348 flatbuffers::Vector<double> *mutable_vf64() { 1349 return GetPointer<flatbuffers::Vector<double> *>(VT_VF64); 1350 } 1351 bool Verify(flatbuffers::Verifier &verifier) const { 1352 return VerifyTableStart(verifier) && 1353 VerifyField<int8_t>(verifier, VT_I8) && 1354 VerifyField<uint8_t>(verifier, VT_U8) && 1355 VerifyField<int16_t>(verifier, VT_I16) && 1356 VerifyField<uint16_t>(verifier, VT_U16) && 1357 VerifyField<int32_t>(verifier, VT_I32) && 1358 VerifyField<uint32_t>(verifier, VT_U32) && 1359 VerifyField<int64_t>(verifier, VT_I64) && 1360 VerifyField<uint64_t>(verifier, VT_U64) && 1361 VerifyField<float>(verifier, VT_F32) && 1362 VerifyField<double>(verifier, VT_F64) && 1363 VerifyOffset(verifier, VT_V8) && 1364 verifier.Verify(v8()) && 1365 VerifyOffset(verifier, VT_VF64) && 1366 verifier.Verify(vf64()) && 1367 verifier.EndTable(); 1368 } 1369 TypeAliasesT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1370 void UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; 1371 static flatbuffers::Offset<TypeAliases> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1372 }; 1373 1374 struct TypeAliasesBuilder { 1375 flatbuffers::FlatBufferBuilder &fbb_; 1376 flatbuffers::uoffset_t start_; 1377 void add_i8(int8_t i8) { 1378 fbb_.AddElement<int8_t>(TypeAliases::VT_I8, i8, 0); 1379 } 1380 void add_u8(uint8_t u8) { 1381 fbb_.AddElement<uint8_t>(TypeAliases::VT_U8, u8, 0); 1382 } 1383 void add_i16(int16_t i16) { 1384 fbb_.AddElement<int16_t>(TypeAliases::VT_I16, i16, 0); 1385 } 1386 void add_u16(uint16_t u16) { 1387 fbb_.AddElement<uint16_t>(TypeAliases::VT_U16, u16, 0); 1388 } 1389 void add_i32(int32_t i32) { 1390 fbb_.AddElement<int32_t>(TypeAliases::VT_I32, i32, 0); 1391 } 1392 void add_u32(uint32_t u32) { 1393 fbb_.AddElement<uint32_t>(TypeAliases::VT_U32, u32, 0); 1394 } 1395 void add_i64(int64_t i64) { 1396 fbb_.AddElement<int64_t>(TypeAliases::VT_I64, i64, 0); 1397 } 1398 void add_u64(uint64_t u64) { 1399 fbb_.AddElement<uint64_t>(TypeAliases::VT_U64, u64, 0); 1400 } 1401 void add_f32(float f32) { 1402 fbb_.AddElement<float>(TypeAliases::VT_F32, f32, 0.0f); 1403 } 1404 void add_f64(double f64) { 1405 fbb_.AddElement<double>(TypeAliases::VT_F64, f64, 0.0); 1406 } 1407 void add_v8(flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8) { 1408 fbb_.AddOffset(TypeAliases::VT_V8, v8); 1409 } 1410 void add_vf64(flatbuffers::Offset<flatbuffers::Vector<double>> vf64) { 1411 fbb_.AddOffset(TypeAliases::VT_VF64, vf64); 1412 } 1413 explicit TypeAliasesBuilder(flatbuffers::FlatBufferBuilder &_fbb) 1414 : fbb_(_fbb) { 1415 start_ = fbb_.StartTable(); 1416 } 1417 TypeAliasesBuilder &operator=(const TypeAliasesBuilder &); 1418 flatbuffers::Offset<TypeAliases> Finish() { 1419 const auto end = fbb_.EndTable(start_); 1420 auto o = flatbuffers::Offset<TypeAliases>(end); 1421 return o; 1422 } 1423 }; 1424 1425 inline flatbuffers::Offset<TypeAliases> CreateTypeAliases( 1426 flatbuffers::FlatBufferBuilder &_fbb, 1427 int8_t i8 = 0, 1428 uint8_t u8 = 0, 1429 int16_t i16 = 0, 1430 uint16_t u16 = 0, 1431 int32_t i32 = 0, 1432 uint32_t u32 = 0, 1433 int64_t i64 = 0, 1434 uint64_t u64 = 0, 1435 float f32 = 0.0f, 1436 double f64 = 0.0, 1437 flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8 = 0, 1438 flatbuffers::Offset<flatbuffers::Vector<double>> vf64 = 0) { 1439 TypeAliasesBuilder builder_(_fbb); 1440 builder_.add_f64(f64); 1441 builder_.add_u64(u64); 1442 builder_.add_i64(i64); 1443 builder_.add_vf64(vf64); 1444 builder_.add_v8(v8); 1445 builder_.add_f32(f32); 1446 builder_.add_u32(u32); 1447 builder_.add_i32(i32); 1448 builder_.add_u16(u16); 1449 builder_.add_i16(i16); 1450 builder_.add_u8(u8); 1451 builder_.add_i8(i8); 1452 return builder_.Finish(); 1453 } 1454 1455 inline flatbuffers::Offset<TypeAliases> CreateTypeAliasesDirect( 1456 flatbuffers::FlatBufferBuilder &_fbb, 1457 int8_t i8 = 0, 1458 uint8_t u8 = 0, 1459 int16_t i16 = 0, 1460 uint16_t u16 = 0, 1461 int32_t i32 = 0, 1462 uint32_t u32 = 0, 1463 int64_t i64 = 0, 1464 uint64_t u64 = 0, 1465 float f32 = 0.0f, 1466 double f64 = 0.0, 1467 const std::vector<int8_t> *v8 = nullptr, 1468 const std::vector<double> *vf64 = nullptr) { 1469 return MyGame::Example::CreateTypeAliases( 1470 _fbb, 1471 i8, 1472 u8, 1473 i16, 1474 u16, 1475 i32, 1476 u32, 1477 i64, 1478 u64, 1479 f32, 1480 f64, 1481 v8 ? _fbb.CreateVector<int8_t>(*v8) : 0, 1482 vf64 ? _fbb.CreateVector<double>(*vf64) : 0); 1483 } 1484 1485 flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); 1486 1487 } // namespace Example 1488 1489 inline InParentNamespaceT *InParentNamespace::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 1490 auto _o = new InParentNamespaceT(); 1491 UnPackTo(_o, _resolver); 1492 return _o; 1493 } 1494 1495 inline void InParentNamespace::UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver) const { 1496 (void)_o; 1497 (void)_resolver; 1498 } 1499 1500 inline flatbuffers::Offset<InParentNamespace> InParentNamespace::Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 1501 return CreateInParentNamespace(_fbb, _o, _rehasher); 1502 } 1503 1504 inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 1505 (void)_rehasher; 1506 (void)_o; 1507 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const InParentNamespaceT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 1508 return MyGame::CreateInParentNamespace( 1509 _fbb); 1510 } 1511 1512 namespace Example2 { 1513 1514 inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 1515 auto _o = new MonsterT(); 1516 UnPackTo(_o, _resolver); 1517 return _o; 1518 } 1519 1520 inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const { 1521 (void)_o; 1522 (void)_resolver; 1523 } 1524 1525 inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 1526 return CreateMonster(_fbb, _o, _rehasher); 1527 } 1528 1529 inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 1530 (void)_rehasher; 1531 (void)_o; 1532 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 1533 return MyGame::Example2::CreateMonster( 1534 _fbb); 1535 } 1536 1537 } // namespace Example2 1538 1539 namespace Example { 1540 1541 inline TestSimpleTableWithEnumT *TestSimpleTableWithEnum::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 1542 auto _o = new TestSimpleTableWithEnumT(); 1543 UnPackTo(_o, _resolver); 1544 return _o; 1545 } 1546 1547 inline void TestSimpleTableWithEnum::UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver) const { 1548 (void)_o; 1549 (void)_resolver; 1550 { auto _e = color(); _o->color = _e; }; 1551 } 1552 1553 inline flatbuffers::Offset<TestSimpleTableWithEnum> TestSimpleTableWithEnum::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 1554 return CreateTestSimpleTableWithEnum(_fbb, _o, _rehasher); 1555 } 1556 1557 inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 1558 (void)_rehasher; 1559 (void)_o; 1560 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TestSimpleTableWithEnumT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 1561 auto _color = _o->color; 1562 return MyGame::Example::CreateTestSimpleTableWithEnum( 1563 _fbb, 1564 _color); 1565 } 1566 1567 inline StatT *Stat::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 1568 auto _o = new StatT(); 1569 UnPackTo(_o, _resolver); 1570 return _o; 1571 } 1572 1573 inline void Stat::UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver) const { 1574 (void)_o; 1575 (void)_resolver; 1576 { auto _e = id(); if (_e) _o->id = _e->str(); }; 1577 { auto _e = val(); _o->val = _e; }; 1578 { auto _e = count(); _o->count = _e; }; 1579 } 1580 1581 inline flatbuffers::Offset<Stat> Stat::Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 1582 return CreateStat(_fbb, _o, _rehasher); 1583 } 1584 1585 inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 1586 (void)_rehasher; 1587 (void)_o; 1588 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const StatT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 1589 auto _id = _o->id.empty() ? 0 : _fbb.CreateString(_o->id); 1590 auto _val = _o->val; 1591 auto _count = _o->count; 1592 return MyGame::Example::CreateStat( 1593 _fbb, 1594 _id, 1595 _val, 1596 _count); 1597 } 1598 1599 inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 1600 auto _o = new MonsterT(); 1601 UnPackTo(_o, _resolver); 1602 return _o; 1603 } 1604 1605 inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const { 1606 (void)_o; 1607 (void)_resolver; 1608 { auto _e = pos(); if (_e) _o->pos = flatbuffers::unique_ptr<Vec3>(new Vec3(*_e)); }; 1609 { auto _e = mana(); _o->mana = _e; }; 1610 { auto _e = hp(); _o->hp = _e; }; 1611 { auto _e = name(); if (_e) _o->name = _e->str(); }; 1612 { auto _e = inventory(); if (_e) { _o->inventory.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->inventory[_i] = _e->Get(_i); } } }; 1613 { auto _e = color(); _o->color = _e; }; 1614 { auto _e = test_type(); _o->test.type = _e; }; 1615 { auto _e = test(); if (_e) _o->test.value = AnyUnion::UnPack(_e, test_type(), _resolver); }; 1616 { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } }; 1617 { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } }; 1618 { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayoftables[_i] = flatbuffers::unique_ptr<MonsterT>(_e->Get(_i)->UnPack(_resolver)); } } }; 1619 { auto _e = enemy(); if (_e) _o->enemy = flatbuffers::unique_ptr<MonsterT>(_e->UnPack(_resolver)); }; 1620 { auto _e = testnestedflatbuffer(); if (_e) { _o->testnestedflatbuffer.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testnestedflatbuffer[_i] = _e->Get(_i); } } }; 1621 { auto _e = testempty(); if (_e) _o->testempty = flatbuffers::unique_ptr<StatT>(_e->UnPack(_resolver)); }; 1622 { auto _e = testbool(); _o->testbool = _e; }; 1623 { auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; }; 1624 { auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; }; 1625 { auto _e = testhashs64_fnv1(); _o->testhashs64_fnv1 = _e; }; 1626 { auto _e = testhashu64_fnv1(); _o->testhashu64_fnv1 = _e; }; 1627 { auto _e = testhashs32_fnv1a(); _o->testhashs32_fnv1a = _e; }; 1628 { 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; }; 1629 { auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; }; 1630 { auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; }; 1631 { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } }; 1632 { auto _e = testf(); _o->testf = _e; }; 1633 { auto _e = testf2(); _o->testf2 = _e; }; 1634 { auto _e = testf3(); _o->testf3 = _e; }; 1635 { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } }; 1636 { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } }; 1637 { auto _e = flex(); if (_e) { _o->flex.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->flex[_i] = _e->Get(_i); } } }; 1638 { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } }; 1639 { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } }; 1640 { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } }; 1641 { auto _e = parent_namespace_test(); if (_e) _o->parent_namespace_test = flatbuffers::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); }; 1642 } 1643 1644 inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 1645 return CreateMonster(_fbb, _o, _rehasher); 1646 } 1647 1648 inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 1649 (void)_rehasher; 1650 (void)_o; 1651 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 1652 auto _pos = _o->pos ? _o->pos.get() : 0; 1653 auto _mana = _o->mana; 1654 auto _hp = _o->hp; 1655 auto _name = _fbb.CreateString(_o->name); 1656 auto _inventory = _o->inventory.size() ? _fbb.CreateVector(_o->inventory) : 0; 1657 auto _color = _o->color; 1658 auto _test_type = _o->test.type; 1659 auto _test = _o->test.Pack(_fbb); 1660 auto _test4 = _o->test4.size() ? _fbb.CreateVectorOfStructs(_o->test4) : 0; 1661 auto _testarrayofstring = _o->testarrayofstring.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring) : 0; 1662 auto _testarrayoftables = _o->testarrayoftables.size() ? _fbb.CreateVector<flatbuffers::Offset<Monster>> (_o->testarrayoftables.size(), [](size_t i, _VectorArgs *__va) { return CreateMonster(*__va->__fbb, __va->__o->testarrayoftables[i].get(), __va->__rehasher); }, &_va ) : 0; 1663 auto _enemy = _o->enemy ? CreateMonster(_fbb, _o->enemy.get(), _rehasher) : 0; 1664 auto _testnestedflatbuffer = _o->testnestedflatbuffer.size() ? _fbb.CreateVector(_o->testnestedflatbuffer) : 0; 1665 auto _testempty = _o->testempty ? CreateStat(_fbb, _o->testempty.get(), _rehasher) : 0; 1666 auto _testbool = _o->testbool; 1667 auto _testhashs32_fnv1 = _o->testhashs32_fnv1; 1668 auto _testhashu32_fnv1 = _o->testhashu32_fnv1; 1669 auto _testhashs64_fnv1 = _o->testhashs64_fnv1; 1670 auto _testhashu64_fnv1 = _o->testhashu64_fnv1; 1671 auto _testhashs32_fnv1a = _o->testhashs32_fnv1a; 1672 auto _testhashu32_fnv1a = _rehasher ? static_cast<uint32_t>((*_rehasher)(_o->testhashu32_fnv1a)) : 0; 1673 auto _testhashs64_fnv1a = _o->testhashs64_fnv1a; 1674 auto _testhashu64_fnv1a = _o->testhashu64_fnv1a; 1675 auto _testarrayofbools = _o->testarrayofbools.size() ? _fbb.CreateVector(_o->testarrayofbools) : 0; 1676 auto _testf = _o->testf; 1677 auto _testf2 = _o->testf2; 1678 auto _testf3 = _o->testf3; 1679 auto _testarrayofstring2 = _o->testarrayofstring2.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring2) : 0; 1680 auto _testarrayofsortedstruct = _o->testarrayofsortedstruct.size() ? _fbb.CreateVectorOfStructs(_o->testarrayofsortedstruct) : 0; 1681 auto _flex = _o->flex.size() ? _fbb.CreateVector(_o->flex) : 0; 1682 auto _test5 = _o->test5.size() ? _fbb.CreateVectorOfStructs(_o->test5) : 0; 1683 auto _vector_of_longs = _o->vector_of_longs.size() ? _fbb.CreateVector(_o->vector_of_longs) : 0; 1684 auto _vector_of_doubles = _o->vector_of_doubles.size() ? _fbb.CreateVector(_o->vector_of_doubles) : 0; 1685 auto _parent_namespace_test = _o->parent_namespace_test ? CreateInParentNamespace(_fbb, _o->parent_namespace_test.get(), _rehasher) : 0; 1686 return MyGame::Example::CreateMonster( 1687 _fbb, 1688 _pos, 1689 _mana, 1690 _hp, 1691 _name, 1692 _inventory, 1693 _color, 1694 _test_type, 1695 _test, 1696 _test4, 1697 _testarrayofstring, 1698 _testarrayoftables, 1699 _enemy, 1700 _testnestedflatbuffer, 1701 _testempty, 1702 _testbool, 1703 _testhashs32_fnv1, 1704 _testhashu32_fnv1, 1705 _testhashs64_fnv1, 1706 _testhashu64_fnv1, 1707 _testhashs32_fnv1a, 1708 _testhashu32_fnv1a, 1709 _testhashs64_fnv1a, 1710 _testhashu64_fnv1a, 1711 _testarrayofbools, 1712 _testf, 1713 _testf2, 1714 _testf3, 1715 _testarrayofstring2, 1716 _testarrayofsortedstruct, 1717 _flex, 1718 _test5, 1719 _vector_of_longs, 1720 _vector_of_doubles, 1721 _parent_namespace_test); 1722 } 1723 1724 inline TypeAliasesT *TypeAliases::UnPack(const flatbuffers::resolver_function_t *_resolver) const { 1725 auto _o = new TypeAliasesT(); 1726 UnPackTo(_o, _resolver); 1727 return _o; 1728 } 1729 1730 inline void TypeAliases::UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver) const { 1731 (void)_o; 1732 (void)_resolver; 1733 { auto _e = i8(); _o->i8 = _e; }; 1734 { auto _e = u8(); _o->u8 = _e; }; 1735 { auto _e = i16(); _o->i16 = _e; }; 1736 { auto _e = u16(); _o->u16 = _e; }; 1737 { auto _e = i32(); _o->i32 = _e; }; 1738 { auto _e = u32(); _o->u32 = _e; }; 1739 { auto _e = i64(); _o->i64 = _e; }; 1740 { auto _e = u64(); _o->u64 = _e; }; 1741 { auto _e = f32(); _o->f32 = _e; }; 1742 { auto _e = f64(); _o->f64 = _e; }; 1743 { auto _e = v8(); if (_e) { _o->v8.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->v8[_i] = _e->Get(_i); } } }; 1744 { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } }; 1745 } 1746 1747 inline flatbuffers::Offset<TypeAliases> TypeAliases::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher) { 1748 return CreateTypeAliases(_fbb, _o, _rehasher); 1749 } 1750 1751 inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher) { 1752 (void)_rehasher; 1753 (void)_o; 1754 struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TypeAliasesT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; 1755 auto _i8 = _o->i8; 1756 auto _u8 = _o->u8; 1757 auto _i16 = _o->i16; 1758 auto _u16 = _o->u16; 1759 auto _i32 = _o->i32; 1760 auto _u32 = _o->u32; 1761 auto _i64 = _o->i64; 1762 auto _u64 = _o->u64; 1763 auto _f32 = _o->f32; 1764 auto _f64 = _o->f64; 1765 auto _v8 = _o->v8.size() ? _fbb.CreateVector(_o->v8) : 0; 1766 auto _vf64 = _o->vf64.size() ? _fbb.CreateVector(_o->vf64) : 0; 1767 return MyGame::Example::CreateTypeAliases( 1768 _fbb, 1769 _i8, 1770 _u8, 1771 _i16, 1772 _u16, 1773 _i32, 1774 _u32, 1775 _i64, 1776 _u64, 1777 _f32, 1778 _f64, 1779 _v8, 1780 _vf64); 1781 } 1782 1783 inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) { 1784 switch (type) { 1785 case Any_NONE: { 1786 return true; 1787 } 1788 case Any_Monster: { 1789 auto ptr = reinterpret_cast<const Monster *>(obj); 1790 return verifier.VerifyTable(ptr); 1791 } 1792 case Any_TestSimpleTableWithEnum: { 1793 auto ptr = reinterpret_cast<const TestSimpleTableWithEnum *>(obj); 1794 return verifier.VerifyTable(ptr); 1795 } 1796 case Any_MyGame_Example2_Monster: { 1797 auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj); 1798 return verifier.VerifyTable(ptr); 1799 } 1800 default: return false; 1801 } 1802 } 1803 1804 inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) { 1805 if (values->size() != types->size()) return false; 1806 for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { 1807 if (!VerifyAny( 1808 verifier, values->Get(i), types->GetEnum<Any>(i))) { 1809 return false; 1810 } 1811 } 1812 return true; 1813 } 1814 1815 inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) { 1816 switch (type) { 1817 case Any_Monster: { 1818 auto ptr = reinterpret_cast<const Monster *>(obj); 1819 return ptr->UnPack(resolver); 1820 } 1821 case Any_TestSimpleTableWithEnum: { 1822 auto ptr = reinterpret_cast<const TestSimpleTableWithEnum *>(obj); 1823 return ptr->UnPack(resolver); 1824 } 1825 case Any_MyGame_Example2_Monster: { 1826 auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj); 1827 return ptr->UnPack(resolver); 1828 } 1829 default: return nullptr; 1830 } 1831 } 1832 1833 inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const { 1834 switch (type) { 1835 case Any_Monster: { 1836 auto ptr = reinterpret_cast<const MonsterT *>(value); 1837 return CreateMonster(_fbb, ptr, _rehasher).Union(); 1838 } 1839 case Any_TestSimpleTableWithEnum: { 1840 auto ptr = reinterpret_cast<const TestSimpleTableWithEnumT *>(value); 1841 return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union(); 1842 } 1843 case Any_MyGame_Example2_Monster: { 1844 auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value); 1845 return CreateMonster(_fbb, ptr, _rehasher).Union(); 1846 } 1847 default: return 0; 1848 } 1849 } 1850 1851 inline AnyUnion::AnyUnion(const AnyUnion &u) FLATBUFFERS_NOEXCEPT : type(u.type), value(nullptr) { 1852 switch (type) { 1853 case Any_Monster: { 1854 assert(false); // MonsterT not copyable. 1855 break; 1856 } 1857 case Any_TestSimpleTableWithEnum: { 1858 value = new TestSimpleTableWithEnumT(*reinterpret_cast<TestSimpleTableWithEnumT *>(u.value)); 1859 break; 1860 } 1861 case Any_MyGame_Example2_Monster: { 1862 value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value)); 1863 break; 1864 } 1865 default: 1866 break; 1867 } 1868 } 1869 1870 inline void AnyUnion::Reset() { 1871 switch (type) { 1872 case Any_Monster: { 1873 auto ptr = reinterpret_cast<MonsterT *>(value); 1874 delete ptr; 1875 break; 1876 } 1877 case Any_TestSimpleTableWithEnum: { 1878 auto ptr = reinterpret_cast<TestSimpleTableWithEnumT *>(value); 1879 delete ptr; 1880 break; 1881 } 1882 case Any_MyGame_Example2_Monster: { 1883 auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value); 1884 delete ptr; 1885 break; 1886 } 1887 default: break; 1888 } 1889 value = nullptr; 1890 type = Any_NONE; 1891 } 1892 1893 } // namespace Example 1894 1895 inline flatbuffers::TypeTable *InParentNamespaceTypeTable(); 1896 1897 namespace Example2 { 1898 1899 inline flatbuffers::TypeTable *MonsterTypeTable(); 1900 1901 } // namespace Example2 1902 1903 namespace Example { 1904 1905 inline flatbuffers::TypeTable *TestTypeTable(); 1906 1907 inline flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable(); 1908 1909 inline flatbuffers::TypeTable *Vec3TypeTable(); 1910 1911 inline flatbuffers::TypeTable *AbilityTypeTable(); 1912 1913 inline flatbuffers::TypeTable *StatTypeTable(); 1914 1915 inline flatbuffers::TypeTable *MonsterTypeTable(); 1916 1917 inline flatbuffers::TypeTable *TypeAliasesTypeTable(); 1918 1919 inline flatbuffers::TypeTable *ColorTypeTable() { 1920 static flatbuffers::TypeCode type_codes[] = { 1921 { flatbuffers::ET_CHAR, 0, 0 }, 1922 { flatbuffers::ET_CHAR, 0, 0 }, 1923 { flatbuffers::ET_CHAR, 0, 0 } 1924 }; 1925 static flatbuffers::TypeFunction type_refs[] = { 1926 ColorTypeTable 1927 }; 1928 static const int32_t values[] = { 1, 2, 8 }; 1929 static const char *names[] = { 1930 "Red", 1931 "Green", 1932 "Blue" 1933 }; 1934 static flatbuffers::TypeTable tt = { 1935 flatbuffers::ST_ENUM, 3, type_codes, type_refs, values, names 1936 }; 1937 return &tt; 1938 } 1939 1940 inline flatbuffers::TypeTable *AnyTypeTable() { 1941 static flatbuffers::TypeCode type_codes[] = { 1942 { flatbuffers::ET_SEQUENCE, 0, -1 }, 1943 { flatbuffers::ET_SEQUENCE, 0, 0 }, 1944 { flatbuffers::ET_SEQUENCE, 0, 1 }, 1945 { flatbuffers::ET_SEQUENCE, 0, 2 } 1946 }; 1947 static flatbuffers::TypeFunction type_refs[] = { 1948 MonsterTypeTable, 1949 TestSimpleTableWithEnumTypeTable, 1950 MyGame::Example2::MonsterTypeTable 1951 }; 1952 static const char *names[] = { 1953 "NONE", 1954 "Monster", 1955 "TestSimpleTableWithEnum", 1956 "MyGame_Example2_Monster" 1957 }; 1958 static flatbuffers::TypeTable tt = { 1959 flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, names 1960 }; 1961 return &tt; 1962 } 1963 1964 } // namespace Example 1965 1966 inline flatbuffers::TypeTable *InParentNamespaceTypeTable() { 1967 static flatbuffers::TypeTable tt = { 1968 flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr 1969 }; 1970 return &tt; 1971 } 1972 1973 namespace Example2 { 1974 1975 inline flatbuffers::TypeTable *MonsterTypeTable() { 1976 static flatbuffers::TypeTable tt = { 1977 flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr 1978 }; 1979 return &tt; 1980 } 1981 1982 } // namespace Example2 1983 1984 namespace Example { 1985 1986 inline flatbuffers::TypeTable *TestTypeTable() { 1987 static flatbuffers::TypeCode type_codes[] = { 1988 { flatbuffers::ET_SHORT, 0, -1 }, 1989 { flatbuffers::ET_CHAR, 0, -1 } 1990 }; 1991 static const int32_t values[] = { 0, 2, 4 }; 1992 static const char *names[] = { 1993 "a", 1994 "b" 1995 }; 1996 static flatbuffers::TypeTable tt = { 1997 flatbuffers::ST_STRUCT, 2, type_codes, nullptr, values, names 1998 }; 1999 return &tt; 2000 } 2001 2002 inline flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable() { 2003 static flatbuffers::TypeCode type_codes[] = { 2004 { flatbuffers::ET_CHAR, 0, 0 } 2005 }; 2006 static flatbuffers::TypeFunction type_refs[] = { 2007 ColorTypeTable 2008 }; 2009 static const char *names[] = { 2010 "color" 2011 }; 2012 static flatbuffers::TypeTable tt = { 2013 flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, names 2014 }; 2015 return &tt; 2016 } 2017 2018 inline flatbuffers::TypeTable *Vec3TypeTable() { 2019 static flatbuffers::TypeCode type_codes[] = { 2020 { flatbuffers::ET_FLOAT, 0, -1 }, 2021 { flatbuffers::ET_FLOAT, 0, -1 }, 2022 { flatbuffers::ET_FLOAT, 0, -1 }, 2023 { flatbuffers::ET_DOUBLE, 0, -1 }, 2024 { flatbuffers::ET_CHAR, 0, 0 }, 2025 { flatbuffers::ET_SEQUENCE, 0, 1 } 2026 }; 2027 static flatbuffers::TypeFunction type_refs[] = { 2028 ColorTypeTable, 2029 TestTypeTable 2030 }; 2031 static const int32_t values[] = { 0, 4, 8, 16, 24, 26, 32 }; 2032 static const char *names[] = { 2033 "x", 2034 "y", 2035 "z", 2036 "test1", 2037 "test2", 2038 "test3" 2039 }; 2040 static flatbuffers::TypeTable tt = { 2041 flatbuffers::ST_STRUCT, 6, type_codes, type_refs, values, names 2042 }; 2043 return &tt; 2044 } 2045 2046 inline flatbuffers::TypeTable *AbilityTypeTable() { 2047 static flatbuffers::TypeCode type_codes[] = { 2048 { flatbuffers::ET_UINT, 0, -1 }, 2049 { flatbuffers::ET_UINT, 0, -1 } 2050 }; 2051 static const int32_t values[] = { 0, 4, 8 }; 2052 static const char *names[] = { 2053 "id", 2054 "distance" 2055 }; 2056 static flatbuffers::TypeTable tt = { 2057 flatbuffers::ST_STRUCT, 2, type_codes, nullptr, values, names 2058 }; 2059 return &tt; 2060 } 2061 2062 inline flatbuffers::TypeTable *StatTypeTable() { 2063 static flatbuffers::TypeCode type_codes[] = { 2064 { flatbuffers::ET_STRING, 0, -1 }, 2065 { flatbuffers::ET_LONG, 0, -1 }, 2066 { flatbuffers::ET_USHORT, 0, -1 } 2067 }; 2068 static const char *names[] = { 2069 "id", 2070 "val", 2071 "count" 2072 }; 2073 static flatbuffers::TypeTable tt = { 2074 flatbuffers::ST_TABLE, 3, type_codes, nullptr, nullptr, names 2075 }; 2076 return &tt; 2077 } 2078 2079 inline flatbuffers::TypeTable *MonsterTypeTable() { 2080 static flatbuffers::TypeCode type_codes[] = { 2081 { flatbuffers::ET_SEQUENCE, 0, 0 }, 2082 { flatbuffers::ET_SHORT, 0, -1 }, 2083 { flatbuffers::ET_SHORT, 0, -1 }, 2084 { flatbuffers::ET_STRING, 0, -1 }, 2085 { flatbuffers::ET_BOOL, 0, -1 }, 2086 { flatbuffers::ET_UCHAR, 1, -1 }, 2087 { flatbuffers::ET_CHAR, 0, 1 }, 2088 { flatbuffers::ET_UTYPE, 0, 2 }, 2089 { flatbuffers::ET_SEQUENCE, 0, 2 }, 2090 { flatbuffers::ET_SEQUENCE, 1, 3 }, 2091 { flatbuffers::ET_STRING, 1, -1 }, 2092 { flatbuffers::ET_SEQUENCE, 1, 4 }, 2093 { flatbuffers::ET_SEQUENCE, 0, 4 }, 2094 { flatbuffers::ET_UCHAR, 1, -1 }, 2095 { flatbuffers::ET_SEQUENCE, 0, 5 }, 2096 { flatbuffers::ET_BOOL, 0, -1 }, 2097 { flatbuffers::ET_INT, 0, -1 }, 2098 { flatbuffers::ET_UINT, 0, -1 }, 2099 { flatbuffers::ET_LONG, 0, -1 }, 2100 { flatbuffers::ET_ULONG, 0, -1 }, 2101 { flatbuffers::ET_INT, 0, -1 }, 2102 { flatbuffers::ET_UINT, 0, -1 }, 2103 { flatbuffers::ET_LONG, 0, -1 }, 2104 { flatbuffers::ET_ULONG, 0, -1 }, 2105 { flatbuffers::ET_BOOL, 1, -1 }, 2106 { flatbuffers::ET_FLOAT, 0, -1 }, 2107 { flatbuffers::ET_FLOAT, 0, -1 }, 2108 { flatbuffers::ET_FLOAT, 0, -1 }, 2109 { flatbuffers::ET_STRING, 1, -1 }, 2110 { flatbuffers::ET_SEQUENCE, 1, 6 }, 2111 { flatbuffers::ET_UCHAR, 1, -1 }, 2112 { flatbuffers::ET_SEQUENCE, 1, 3 }, 2113 { flatbuffers::ET_LONG, 1, -1 }, 2114 { flatbuffers::ET_DOUBLE, 1, -1 }, 2115 { flatbuffers::ET_SEQUENCE, 0, 7 } 2116 }; 2117 static flatbuffers::TypeFunction type_refs[] = { 2118 Vec3TypeTable, 2119 ColorTypeTable, 2120 AnyTypeTable, 2121 TestTypeTable, 2122 MonsterTypeTable, 2123 StatTypeTable, 2124 AbilityTypeTable, 2125 MyGame::InParentNamespaceTypeTable 2126 }; 2127 static const char *names[] = { 2128 "pos", 2129 "mana", 2130 "hp", 2131 "name", 2132 "friendly", 2133 "inventory", 2134 "color", 2135 "test_type", 2136 "test", 2137 "test4", 2138 "testarrayofstring", 2139 "testarrayoftables", 2140 "enemy", 2141 "testnestedflatbuffer", 2142 "testempty", 2143 "testbool", 2144 "testhashs32_fnv1", 2145 "testhashu32_fnv1", 2146 "testhashs64_fnv1", 2147 "testhashu64_fnv1", 2148 "testhashs32_fnv1a", 2149 "testhashu32_fnv1a", 2150 "testhashs64_fnv1a", 2151 "testhashu64_fnv1a", 2152 "testarrayofbools", 2153 "testf", 2154 "testf2", 2155 "testf3", 2156 "testarrayofstring2", 2157 "testarrayofsortedstruct", 2158 "flex", 2159 "test5", 2160 "vector_of_longs", 2161 "vector_of_doubles", 2162 "parent_namespace_test" 2163 }; 2164 static flatbuffers::TypeTable tt = { 2165 flatbuffers::ST_TABLE, 35, type_codes, type_refs, nullptr, names 2166 }; 2167 return &tt; 2168 } 2169 2170 inline flatbuffers::TypeTable *TypeAliasesTypeTable() { 2171 static flatbuffers::TypeCode type_codes[] = { 2172 { flatbuffers::ET_CHAR, 0, -1 }, 2173 { flatbuffers::ET_UCHAR, 0, -1 }, 2174 { flatbuffers::ET_SHORT, 0, -1 }, 2175 { flatbuffers::ET_USHORT, 0, -1 }, 2176 { flatbuffers::ET_INT, 0, -1 }, 2177 { flatbuffers::ET_UINT, 0, -1 }, 2178 { flatbuffers::ET_LONG, 0, -1 }, 2179 { flatbuffers::ET_ULONG, 0, -1 }, 2180 { flatbuffers::ET_FLOAT, 0, -1 }, 2181 { flatbuffers::ET_DOUBLE, 0, -1 }, 2182 { flatbuffers::ET_CHAR, 1, -1 }, 2183 { flatbuffers::ET_DOUBLE, 1, -1 } 2184 }; 2185 static const char *names[] = { 2186 "i8", 2187 "u8", 2188 "i16", 2189 "u16", 2190 "i32", 2191 "u32", 2192 "i64", 2193 "u64", 2194 "f32", 2195 "f64", 2196 "v8", 2197 "vf64" 2198 }; 2199 static flatbuffers::TypeTable tt = { 2200 flatbuffers::ST_TABLE, 12, type_codes, nullptr, nullptr, names 2201 }; 2202 return &tt; 2203 } 2204 2205 inline const MyGame::Example::Monster *GetMonster(const void *buf) { 2206 return flatbuffers::GetRoot<MyGame::Example::Monster>(buf); 2207 } 2208 2209 inline Monster *GetMutableMonster(void *buf) { 2210 return flatbuffers::GetMutableRoot<Monster>(buf); 2211 } 2212 2213 inline const char *MonsterIdentifier() { 2214 return "MONS"; 2215 } 2216 2217 inline bool MonsterBufferHasIdentifier(const void *buf) { 2218 return flatbuffers::BufferHasIdentifier( 2219 buf, MonsterIdentifier()); 2220 } 2221 2222 inline bool VerifyMonsterBuffer( 2223 flatbuffers::Verifier &verifier) { 2224 return verifier.VerifyBuffer<MyGame::Example::Monster>(MonsterIdentifier()); 2225 } 2226 2227 inline const char *MonsterExtension() { 2228 return "mon"; 2229 } 2230 2231 inline void FinishMonsterBuffer( 2232 flatbuffers::FlatBufferBuilder &fbb, 2233 flatbuffers::Offset<MyGame::Example::Monster> root) { 2234 fbb.Finish(root, MonsterIdentifier()); 2235 } 2236 2237 inline flatbuffers::unique_ptr<MonsterT> UnPackMonster( 2238 const void *buf, 2239 const flatbuffers::resolver_function_t *res = nullptr) { 2240 return flatbuffers::unique_ptr<MonsterT>(GetMonster(buf)->UnPack(res)); 2241 } 2242 2243 } // namespace Example 2244 } // namespace MyGame 2245 2246 #endif // FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_ 2247