summaryrefslogtreecommitdiff
path: root/samples/monster_generated.h
diff options
context:
space:
mode:
authorFrank Benkstein <frank@benkstein.net>2018-10-22 15:57:45 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2018-10-22 15:57:45 -0700
commitca417426c7694d962752c6124d3b77878987323a (patch)
treef69f6c599dd896160d5076f6423798e752e4c894 /samples/monster_generated.h
parent55b30827f266a07ae869fa03b615561140b1513b (diff)
downloadflatbuffers-ca417426c7694d962752c6124d3b77878987323a.tar.gz
flatbuffers-ca417426c7694d962752c6124d3b77878987323a.tar.bz2
flatbuffers-ca417426c7694d962752c6124d3b77878987323a.zip
make flatbuffers::IsFieldPresent safer (#4988)
Give the vtable offset enum inside each table the name "FlatBuffersVTableOffset" and base type voffset_t so it can be used as a dependent type in IsFieldPresent. This makes that function slightly safer since it prevents calling it with arbitrary, non-table types. Now, the only way to use IsFieldPresent incorrectly is to create your own type which does not inherit from flatbuffers::Table but has a dependent voffset convertible type "FlatBuffersVTableOffset".
Diffstat (limited to 'samples/monster_generated.h')
-rw-r--r--samples/monster_generated.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/samples/monster_generated.h b/samples/monster_generated.h
index 4fbbeccc..153eac66 100644
--- a/samples/monster_generated.h
+++ b/samples/monster_generated.h
@@ -235,7 +235,7 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return MonsterTypeTable();
}
- enum {
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_POS = 4,
VT_MANA = 6,
VT_HP = 8,
@@ -443,7 +443,7 @@ struct Weapon FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return WeaponTypeTable();
}
- enum {
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NAME = 4,
VT_DAMAGE = 6
};