Refactor FieldDef to model presense as an enum rather than 2 bools. (#6420)
authorCasper <casperneo@uchicago.edu>
Mon, 25 Jan 2021 17:29:43 +0000 (12:29 -0500)
committerGitHub <noreply@github.com>
Mon, 25 Jan 2021 17:29:43 +0000 (09:29 -0800)
commite581013e3d42af13d2fe37b0ac46a3fd43f3638c
treebbcaa819c809f3103179392125da1d8ea19103c3
parent0984d4328dfa25eb1e79d25d92e134debcedfd7b
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>
14 files changed:
include/flatbuffers/idl.h
src/idl_gen_cpp.cpp
src/idl_gen_csharp.cpp
src/idl_gen_fbs.cpp
src/idl_gen_java.cpp
src/idl_gen_json_schema.cpp
src/idl_gen_kotlin.cpp
src/idl_gen_lobster.cpp
src/idl_gen_php.cpp
src/idl_gen_rust.cpp
src/idl_gen_swift.cpp
src/idl_gen_ts.cpp
src/idl_parser.cpp
tests/test.cpp