[flac] Add FlexBuffers option for generating data (#5519)

Alongside --binary and --json, an additional
switch (--flexbuffers) can be passed to convert
data using FlexBuffers
This commit is contained in:
Paulo Pinheiro
2019-09-27 00:06:11 +02:00
committed by Wouter van Oortmerssen
parent a92039687a
commit cfb4ecf6f0
6 changed files with 52 additions and 4 deletions

View File

@@ -2710,7 +2710,13 @@ bool Parser::ParseFlexBuffer(const char *source, const char *source_filename,
bool Parser::Parse(const char *source, const char **include_paths,
const char *source_filename) {
FLATBUFFERS_ASSERT(0 == recurse_protection_counter);
auto r = !ParseRoot(source, include_paths, source_filename).Check();
bool r;
if (opts.use_flexbuffers) {
r = ParseFlexBuffer(source, source_filename, &flex_builder_);
} else {
r = !ParseRoot(source, include_paths, source_filename).Check();
}
FLATBUFFERS_ASSERT(0 == recurse_protection_counter);
return r;
}