summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authordesqaz <hitite@gmail.com>2018-02-22 18:19:08 +0100
committerWouter van Oortmerssen <aardappel@gmail.com>2018-02-22 09:19:08 -0800
commit132e6a822045434cd5a6fb636c32791480b27f37 (patch)
treea71b4cdcfc4043f33eef94130299a47104826eab /samples
parent19c81b11b3b3ed1949b64134184c4bf5144f3564 (diff)
downloadflatbuffers-132e6a822045434cd5a6fb636c32791480b27f37.tar.gz
flatbuffers-132e6a822045434cd5a6fb636c32791480b27f37.tar.bz2
flatbuffers-132e6a822045434cd5a6fb636c32791480b27f37.zip
Add new c++ helpers to ease usage of size prefixed FlatBuffers (#4626)
It was missing some helpers when we choose to use size prefixed FlatBuffers. * Add general helper : GetPrefixedSize * Add generated helpers : * GetSizePrefixedXXX * VerfifySizePrefixedXXXBuffer * FinishSizePrefixedXXXBuffer
Diffstat (limited to 'samples')
-rw-r--r--samples/monster_generated.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/samples/monster_generated.h b/samples/monster_generated.h
index 32d44d00..00c0595e 100644
--- a/samples/monster_generated.h
+++ b/samples/monster_generated.h
@@ -727,6 +727,10 @@ inline const MyGame::Sample::Monster *GetMonster(const void *buf) {
return flatbuffers::GetRoot<MyGame::Sample::Monster>(buf);
}
+inline const MyGame::Sample::Monster *GetSizePrefixedMonster(const void *buf) {
+ return flatbuffers::GetSizePrefixedRoot<MyGame::Sample::Monster>(buf);
+}
+
inline Monster *GetMutableMonster(void *buf) {
return flatbuffers::GetMutableRoot<Monster>(buf);
}
@@ -736,12 +740,23 @@ inline bool VerifyMonsterBuffer(
return verifier.VerifyBuffer<MyGame::Sample::Monster>(nullptr);
}
+inline bool VerifySizePrefixedMonsterBuffer(
+ flatbuffers::Verifier &verifier) {
+ return verifier.VerifySizePrefixedBuffer<MyGame::Sample::Monster>(nullptr);
+}
+
inline void FinishMonsterBuffer(
flatbuffers::FlatBufferBuilder &fbb,
flatbuffers::Offset<MyGame::Sample::Monster> root) {
fbb.Finish(root);
}
+inline void FinishSizePrefixedMonsterBuffer(
+ flatbuffers::FlatBufferBuilder &fbb,
+ flatbuffers::Offset<MyGame::Sample::Monster> root) {
+ fbb.FinishSizePrefixed(root);
+}
+
inline flatbuffers::unique_ptr<MonsterT> UnPackMonster(
const void *buf,
const flatbuffers::resolver_function_t *res = nullptr) {