mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-05 04:58:57 +00:00
Added an IsFieldPresent helper function.
This is implemented as a template function, since Table::CheckField is not reachable by subclasses of Table (private base class). Change-Id: I1ed4d47ce7cb672460ccab61cf7442eb9136b0f1 Tested: on Linux. Bug: 26273432
This commit is contained in:
@@ -221,6 +221,10 @@ void AccessFlatBufferTest(const uint8_t *flatbuf, size_t length) {
|
||||
for (auto it = tests->begin(); it != tests->end(); ++it) {
|
||||
TEST_EQ(it->a() == 10 || it->a() == 30, true); // Just testing iterators.
|
||||
}
|
||||
|
||||
// Checking for presence of fields:
|
||||
TEST_EQ(flatbuffers::IsFieldPresent(monster, Monster::VT_HP), true);
|
||||
TEST_EQ(flatbuffers::IsFieldPresent(monster, Monster::VT_MANA), false);
|
||||
}
|
||||
|
||||
// Change a FlatBuffer in-place, after it has been constructed.
|
||||
|
||||
Reference in New Issue
Block a user