mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-15 16:57:29 +00:00
Refactor FieldDef to model presense as an enum rather than 2 bools. (#6420)
* Define presence. * Migrate to IsRequired and IsOptional methods * moved stuff around * Removed optional and required bools from FieldDef * change assert to return error * Fix tests.cpp * MakeFieldPresence helper * fmt * old c++ compatibility stuff Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
@@ -136,7 +136,7 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name) {
|
||||
GenComment(field.doc_comment, &schema, nullptr, " ");
|
||||
schema += " " + field.name + ":" + GenType(field.value.type);
|
||||
if (field.value.constant != "0") schema += " = " + field.value.constant;
|
||||
if (field.required) schema += " (required)";
|
||||
if (field.IsRequired()) schema += " (required)";
|
||||
schema += ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user