Enums in C++ are now strongly typed.

Accessors and constructors now take enum types rather than ints.

Bug: 16570507
Change-Id: I4b50fd64ad2e662ea2481bc0ccea784326fb31c0
Tested: on Linux and Windows.
This commit is contained in:
Wouter van Oortmerssen
2014-09-23 11:55:42 -07:00
parent 85c9c83844
commit 7b8053570e
14 changed files with 151 additions and 83 deletions

View File

@@ -259,6 +259,13 @@ public:
return IndirectHelper<T>::Read(Data(), i);
}
// If this is a Vector of enums, T will be its storage type, not the enum
// type. This function makes it convenient to retrieve value with enum
// type E.
template<typename E> E GetEnum(uoffset_t i) const {
return static_cast<E>(Get(i));
}
const void *GetStructFromOffset(size_t o) const {
return reinterpret_cast<const void *>(Data() + o);
}