aboutsummaryrefslogtreecommitdiff
path: root/include/flatbuffers/idl.h
diff options
context:
space:
mode:
authorPaulo Pinheiro <paulovictor.pinheiro@gmail.com>2019-09-27 00:06:11 +0200
committerWouter van Oortmerssen <aardappel@gmail.com>2019-09-26 15:06:11 -0700
commitcfb4ecf6f06ffc4b93a70b85bc66903471e1dc8b (patch)
tree5ffcd1177824641b80463f5682abdb58168ab3ec /include/flatbuffers/idl.h
parenta92039687ab8f24d4a817f69bd6d216b6e7bd211 (diff)
downloadflatbuffers-cfb4ecf6f06ffc4b93a70b85bc66903471e1dc8b.tar.gz
[flac] Add FlexBuffers option for generating data (#5519)
Alongside --binary and --json, an additional switch (--flexbuffers) can be passed to convert data using FlexBuffers
Diffstat (limited to 'include/flatbuffers/idl.h')
-rw-r--r--include/flatbuffers/idl.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h
index 506a717d..5dce91a7 100644
--- a/include/flatbuffers/idl.h
+++ b/include/flatbuffers/idl.h
@@ -491,6 +491,8 @@ struct ServiceDef : public Definition {
// Container of options that may apply to any of the source/text generators.
struct IDLOptions {
+ // Use flexbuffers instead for binary and text generation
+ bool use_flexbuffers;
bool strict_json;
bool skip_js_exports;
bool use_goog_js_export_format;
@@ -573,7 +575,8 @@ struct IDLOptions {
bool set_empty_to_null;
IDLOptions()
- : strict_json(false),
+ : use_flexbuffers(false),
+ strict_json(false),
skip_js_exports(false),
use_goog_js_export_format(false),
use_ES6_js_export_format(false),
@@ -707,6 +710,7 @@ class Parser : public ParserState {
explicit Parser(const IDLOptions &options = IDLOptions())
: current_namespace_(nullptr),
empty_namespace_(nullptr),
+ flex_builder_(256, flexbuffers::BUILDER_FLAG_SHARE_ALL),
root_struct_def_(nullptr),
opts(options),
uses_flexbuffers_(false),
@@ -908,6 +912,8 @@ class Parser : public ParserState {
std::string error_; // User readable error_ if Parse() == false
FlatBufferBuilder builder_; // any data contained in the file
+ flexbuffers::Builder flex_builder_;
+ flexbuffers::Reference flex_root_;
StructDef *root_struct_def_;
std::string file_identifier_;
std::string file_extension_;