Distinguish on_string_data and on_key_data
This commit is contained in:
@@ -79,6 +79,18 @@ inline WeaselJsonCallbacks readValueCallbacks() {
|
||||
state->on_end_value();
|
||||
}
|
||||
};
|
||||
result.on_key_data = +[](void *p, const char *buf, int len, int done) {
|
||||
auto *state = (ReadValueState *)p;
|
||||
if (!state->startedData) {
|
||||
state->startedData = true;
|
||||
state->valueStack.emplace_back(std::string());
|
||||
}
|
||||
std::get<std::string>(state->valueStack.back()).append(buf, len);
|
||||
if (done) {
|
||||
state->startedData = false;
|
||||
state->on_end_value();
|
||||
}
|
||||
};
|
||||
result.on_begin_array = +[](void *p) {
|
||||
auto *state = (ReadValueState *)p;
|
||||
state->valueStack.emplace_back(std::make_unique<JsonArray>());
|
||||
|
||||
Reference in New Issue
Block a user