Add a minireflect based json parser.
This parser takes decent json and parses it into a flatbuffer. The
standard library for flatbuffers needs the full fbs definitions for all
the flatbuffers to do this job.
And add a flatbuffer to JSON function.
Change-Id: Ibc6dcd3fcbd7ac9cf9121d8258d1613d8d20661c
diff --git a/third_party/flatbuffers/BUILD b/third_party/flatbuffers/BUILD
index 520f98a..17f5b8c 100644
--- a/third_party/flatbuffers/BUILD
+++ b/third_party/flatbuffers/BUILD
@@ -27,6 +27,7 @@
"src/util.cpp",
],
hdrs = [":public_headers"],
+ copts = ["-Wno-cast-align"],
includes = ["include/"],
linkstatic = 1,
)
@@ -86,11 +87,11 @@
"src/idl_gen_cpp.cpp",
"src/idl_gen_dart.cpp",
"src/idl_gen_general.cpp",
- "src/idl_gen_kotlin.cpp",
"src/idl_gen_go.cpp",
"src/idl_gen_grpc.cpp",
"src/idl_gen_js_ts.cpp",
"src/idl_gen_json_schema.cpp",
+ "src/idl_gen_kotlin.cpp",
"src/idl_gen_lobster.cpp",
"src/idl_gen_lua.cpp",
"src/idl_gen_php.cpp",
@@ -137,8 +138,8 @@
"src/util.cpp",
"tests/namespace_test/namespace_test1_generated.h",
"tests/namespace_test/namespace_test2_generated.h",
- "tests/native_type_test_impl.h",
"tests/native_type_test_impl.cpp",
+ "tests/native_type_test_impl.h",
"tests/test.cpp",
"tests/test_assert.cpp",
"tests/test_assert.h",
@@ -152,12 +153,18 @@
"-DBAZEL_TEST_DATA_PATH",
],
data = [
+ ":tests/arrays_test.bfbs",
+ ":tests/arrays_test.fbs",
+ ":tests/arrays_test.golden",
":tests/include_test/include_test1.fbs",
":tests/include_test/sub/include_test2.fbs",
+ ":tests/monster_extra.fbs",
":tests/monster_test.bfbs",
":tests/monster_test.fbs",
+ ":tests/monsterdata_extra.json",
":tests/monsterdata_test.golden",
":tests/monsterdata_test.json",
+ ":tests/native_type_test.fbs",
":tests/prototest/imported.proto",
":tests/prototest/test.golden",
":tests/prototest/test.proto",
@@ -165,21 +172,15 @@
":tests/unicode_test.json",
":tests/union_vector/union_vector.fbs",
":tests/union_vector/union_vector.json",
- ":tests/monster_extra.fbs",
- ":tests/monsterdata_extra.json",
- ":tests/arrays_test.bfbs",
- ":tests/arrays_test.fbs",
- ":tests/arrays_test.golden",
- ":tests/native_type_test.fbs",
],
includes = [
"include/",
"tests/",
],
deps = [
+ ":arrays_test_cc_fbs",
":monster_extra_cc_fbs",
":monster_test_cc_fbs",
- ":arrays_test_cc_fbs",
":native_type_test_cc_fbs",
],
)
@@ -211,7 +212,8 @@
"--gen-mutable",
"--reflect-names",
"--cpp-ptr-type flatbuffers::unique_ptr",
- "--scoped-enums" ],
+ "--scoped-enums",
+ ],
)
flatbuffer_cc_library(
@@ -220,6 +222,6 @@
flatc_args = [
"--gen-object-api",
"--gen-mutable",
- "--cpp-ptr-type flatbuffers::unique_ptr" ],
+ "--cpp-ptr-type flatbuffers::unique_ptr",
+ ],
)
-
diff --git a/third_party/flatbuffers/include/flatbuffers/minireflect.h b/third_party/flatbuffers/include/flatbuffers/minireflect.h
index 9d648ec..e7b9024 100644
--- a/third_party/flatbuffers/include/flatbuffers/minireflect.h
+++ b/third_party/flatbuffers/include/flatbuffers/minireflect.h
@@ -396,7 +396,7 @@
const TypeTable *type_table,
bool multi_line = false,
bool vector_delimited = true) {
- ToStringVisitor tostring_visitor(multi_line ? "\n" : " ", false, "",
+ ToStringVisitor tostring_visitor(multi_line ? "\n" : " ", true, "",
vector_delimited);
IterateFlatBuffer(buffer, type_table, &tostring_visitor);
return tostring_visitor.s;