JSON property iterator nxt_conf_json_object_next_member().
This commit is contained in:
parent
d8f371dde9
commit
ee381fcca1
2 changed files with 30 additions and 0 deletions
|
@ -43,6 +43,8 @@ nxt_conf_json_value_t *nxt_conf_json_get_value(nxt_conf_json_value_t *value,
|
|||
nxt_str_t *path);
|
||||
nxt_conf_json_value_t *nxt_conf_json_object_get_member(
|
||||
nxt_conf_json_value_t *value, nxt_str_t *name, uint32_t *index);
|
||||
nxt_conf_json_value_t *nxt_conf_json_object_next_member(
|
||||
nxt_conf_json_value_t *value, nxt_str_t *name, uint32_t *next);
|
||||
|
||||
nxt_int_t nxt_conf_json_object_map(nxt_conf_json_value_t *value,
|
||||
nxt_conf_json_object_map_t *map, void *data);
|
||||
|
|
|
@ -370,6 +370,34 @@ nxt_conf_json_object_map(nxt_conf_json_value_t *value,
|
|||
}
|
||||
|
||||
|
||||
nxt_conf_json_value_t *
|
||||
nxt_conf_json_object_next_member(nxt_conf_json_value_t *value, nxt_str_t *name,
|
||||
uint32_t *next)
|
||||
{
|
||||
uint32_t n;
|
||||
nxt_conf_json_object_t *object;
|
||||
nxt_conf_json_obj_member_t *member;
|
||||
|
||||
if (value->type != NXT_CONF_JSON_OBJECT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n = *next;
|
||||
object = value->u.object;
|
||||
|
||||
if (n >= object->count) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
member = &object->members[n];
|
||||
*next = n + 1;
|
||||
|
||||
nxt_conf_json_value_get_string(&member->name, name);
|
||||
|
||||
return &member->value;
|
||||
}
|
||||
|
||||
|
||||
nxt_int_t
|
||||
nxt_conf_json_op_compile(nxt_mp_t *mp, nxt_conf_json_op_t **ops,
|
||||
nxt_conf_json_value_t *root, nxt_str_t *path,
|
||||
|
|
Loading…
Reference in a new issue