Add method GenerateTextFromTable issue #5249 (#5266)

* Create a function GenerateGenerateTextFromTable in order to create a json from any Table

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* Update the test to failed if loadfile or parser return false

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* Fix snake_case name typo + space before &/*

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* use auto

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* Use clang-format on the added code

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>
This commit is contained in:
Anthony Liot
2019-04-05 11:51:29 -07:00
committed by Wouter van Oortmerssen
parent 2d67de3151
commit 249f3b3714
3 changed files with 69 additions and 0 deletions

View File

@@ -834,6 +834,10 @@ extern std::string MakeCamel(const std::string &in, bool first = true);
// strict_json adds "quotes" around field names if true.
// If the flatbuffer cannot be encoded in JSON (e.g., it contains non-UTF-8
// byte arrays in String values), returns false.
extern bool GenerateTextFromTable(const Parser &parser,
const void *table,
const std::string &tablename,
std::string *text);
extern bool GenerateText(const Parser &parser,
const void *flatbuffer,
std::string *text);