Include a SizePrefixed..HasIdentifier for c++. (#6871)

* Include a SizePrefixed..HasIdentifier for c++.

* Add updated generated code.
This commit is contained in:
Justin T Conroy
2022-01-28 22:52:32 -06:00
committed by GitHub
parent dbbaeac85c
commit 19920db39f
10 changed files with 53 additions and 0 deletions

View File

@@ -535,6 +535,14 @@ class CppGenerator : public BaseGenerator {
code_ += " buf, {{STRUCT_NAME}}Identifier());";
code_ += "}";
code_ += "";
// Check if a size-prefixed buffer has the identifier.
code_ += "inline \\";
code_ += "bool SizePrefixed{{STRUCT_NAME}}BufferHasIdentifier(const void *buf) {";
code_ += " return flatbuffers::BufferHasIdentifier(";
code_ += " buf, {{STRUCT_NAME}}Identifier(), true);";
code_ += "}";
code_ += "";
}
// The root verifier.