Let wuffs_aux::DecodeJson use BACKSLASH_X_AS_BYTES

This commit is contained in:
Nigel Tao committed 2020-08-10 15:22:05 +10:00
1 parent 6d81764e14
commit 62c4feb268
7 files changed
+152 -41

No files matched your search

+13
View File
@@ -31,10 +31,21 @@ class DecodeJsonCallbacks {
// strings, the Callbacks implementation is responsible for tracking map keys
// versus other values.
// The JSON file format as specified deals only with (UTF-8) text strings,
// but an unofficial extension allows "ijk\x89m" escapes within those
// strings. DecodeJsonCallbacks' AppendByteString will not be called unless
// WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_X_AS_BYTES is passed to DecodeJson. If
// it is passed, AppendTextString will not be called and all byte strings are
// potentially invalid UTF-8. It is up to the AppendByteString implementation
// whether to test the std::string for UTF-8 validity.
//
// The default AppendByteString implementation returns an error message.
virtual std::string AppendNull() = 0;
virtual std::string AppendBool(bool val) = 0;
virtual std::string AppendF64(double val) = 0;
virtual std::string AppendI64(int64_t val) = 0;
virtual std::string AppendByteString(std::string&& val);
virtual std::string AppendTextString(std::string&& val) = 0;
// Push and Pop are called for container nodes: JSON arrays (lists) and JSON
@@ -60,6 +71,8 @@ class DecodeJsonCallbacks {
//
// Do not keep a reference to buffer or buffer.data.ptr after Done returns,
// as DecodeJson may then de-allocate the backing array.
//
// The default Done implementation is a no-op.
virtual void Done(DecodeJsonResult& result,
sync_io::Input& input,
IOBuffer& buffer);