Allow GenerateText() to indicate failure to encode flatbuffer to JSON (i.e., non-UTF-8 string data)

This commit is contained in:
Ben Hamilton
2016-08-18 10:14:32 -07:00
parent f0d91fa143
commit 94d5643f97
4 changed files with 119 additions and 52 deletions

View File

@@ -596,7 +596,9 @@ extern void GenComment(const std::vector<std::string> &dc,
// if it is less than 0, no linefeeds will be generated either.
// See idl_gen_text.cpp.
// strict_json adds "quotes" around field names if true.
extern void GenerateText(const Parser &parser,
// If the flatbuffer cannot be encoded in JSON (e.g., it contains non-UTF-8
// byte arrays in String values), returns false.
extern bool GenerateText(const Parser &parser,
const void *flatbuffer,
std::string *text);
extern bool GenerateTextFile(const Parser &parser,