jeremybarnes/jml — pull request #6 by LEW21 (2013-08-30 15:21:00+00:00)
Title: JSON parser: Add readJsonString(), refactor all other JSON string functions to use it.

While applying Jeremy's comments to my former patch, I've found a better way to organize all that JSON string-related code. This way, all of the 4 jml's json string functions can be refactored to use just one implementation, and also the Unicode-aware parser is much simpler to write:

auto result = growing_buffer{};
readJsonString(context,
[&](char c) {
result.push_back(c);
},
[&](char16_t c) {
auto buffer = char[4]{};
auto end = utf8::unchecked::append(c, buffer);
for (auto i = buffer; buffer != end; ++i)
result.push_back(*i);
});
return string{result};

(Updated soa pull request will come later.)