diff options
author | Wouter van Oortmerssen <wvo@google.com> | 2014-08-25 10:42:38 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2014-08-25 10:42:38 -0700 |
commit | bc5fa9d52ffd60b4d027f2acc6160982571b9a9c (patch) | |
tree | 8103fbeb7c83250e259553622bd86ce56abe9f5d /samples | |
parent | 11b743688c0fedd4cb561ea0bf4a1d9d81d5663c (diff) | |
download | flatbuffers-bc5fa9d52ffd60b4d027f2acc6160982571b9a9c.tar.gz flatbuffers-bc5fa9d52ffd60b4d027f2acc6160982571b9a9c.tar.bz2 flatbuffers-bc5fa9d52ffd60b4d027f2acc6160982571b9a9c.zip |
Fixed compile errors in VS / gcc for recent commits.
Tested: on Windows & Linux.
Change-Id: I90e18c448fc2fafeb83a6cdc3776174479874562
Diffstat (limited to 'samples')
-rwxr-xr-x | samples/monster_generated.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/samples/monster_generated.h b/samples/monster_generated.h index ed4e5836..b2a44e65 100755 --- a/samples/monster_generated.h +++ b/samples/monster_generated.h @@ -5,9 +5,13 @@ #include "flatbuffers/flatbuffers.h" + namespace MyGame { namespace Sample { +struct Vec3; +struct Monster; + enum { Color_Red = 0, Color_Green = 1, @@ -33,10 +37,7 @@ inline const char **EnumNamesAny() { inline const char *EnumNameAny(int e) { return EnumNamesAny()[e]; } -bool VerifyAny(const flatbuffers::Verifier &verifier, const void *union_obj, uint8_t type); - -struct Vec3; -struct Monster; +bool VerifyAny(flatbuffers::Verifier &verifier, const void *union_obj, uint8_t type); MANUALLY_ALIGNED_STRUCT(4) Vec3 { private: @@ -46,7 +47,7 @@ MANUALLY_ALIGNED_STRUCT(4) Vec3 { public: Vec3(float x, float y, float z) - : x_(flatbuffers::EndianScalar(x)), y_(flatbuffers::EndianScalar(y)), z_(flatbuffers::EndianScalar(z)) {} + : x_(flatbuffers::EndianScalar(x)), y_(flatbuffers::EndianScalar(y)), z_(flatbuffers::EndianScalar(z)) { } float x() const { return flatbuffers::EndianScalar(x_); } float y() const { return flatbuffers::EndianScalar(y_); } @@ -61,8 +62,8 @@ struct Monster : private flatbuffers::Table { const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(10); } const flatbuffers::Vector<uint8_t> *inventory() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(14); } int8_t color() const { return GetField<int8_t>(16, 2); } - bool Verify(const flatbuffers::Verifier &verifier) const { - return VerifyTable(verifier) && + bool Verify(flatbuffers::Verifier &verifier) const { + return VerifyTableStart(verifier) && VerifyField<Vec3>(verifier, 4 /* pos */) && VerifyField<int16_t>(verifier, 6 /* mana */) && VerifyField<int16_t>(verifier, 8 /* hp */) && @@ -70,7 +71,8 @@ struct Monster : private flatbuffers::Table { verifier.Verify(name()) && VerifyField<flatbuffers::uoffset_t>(verifier, 14 /* inventory */) && verifier.Verify(inventory()) && - VerifyField<int8_t>(verifier, 16 /* color */); + VerifyField<int8_t>(verifier, 16 /* color */) && + verifier.EndTable(); } }; @@ -105,7 +107,7 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder return builder_.Finish(); } -bool VerifyAny(const flatbuffers::Verifier &verifier, const void *union_obj, uint8_t type) { +bool VerifyAny(flatbuffers::Verifier &verifier, const void *union_obj, uint8_t type) { switch (type) { case Any_NONE: return true; case Any_Monster: return verifier.VerifyTable(reinterpret_cast<const Monster *>(union_obj)); @@ -115,7 +117,9 @@ bool VerifyAny(const flatbuffers::Verifier &verifier, const void *union_obj, uin inline const Monster *GetMonster(const void *buf) { return flatbuffers::GetRoot<Monster>(buf); } -inline bool VerifyMonsterBuffer(const flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer<Monster>(); } +inline bool VerifyMonsterBuffer(flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer<Monster>(); } + +inline void FinishMonsterBuffer(flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset<Monster> root) { fbb.Finish(root); } } // namespace Sample } // namespace MyGame |