C Collections

cyaml · Section 3

cyaml_dictionary_next

cyaml_dictionary_next - step a dictionary cursor onto the next member

C Collections (libccollections, -lccollections)

#include <ccollections/cyaml.h>
 
bool cyaml_dictionary_next(cyaml_dictionary_iter *it);

Moves the cursor it, which cyaml_dictionary_first(3) filled, to the
member that comes after the current one in insertion order.  After a
call that returns true, it->key and it->value describe that member.
The cursor has held that member since it reached the current one, so
any change that leaves that successor in place keeps it valid: A
replacement of any value, the removal of any other member, and an
insert.  Removing the successor or destroying the dictionary
invalidates it.  cyaml_dictionary_first(3) describes the order, how
long it->key and it->value live, and each of those changes.

it  A cursor that cyaml_dictionary_first(3) filled.

true when it stands on the next member.
 
false when the previous call gave the last member, and on every call
after that, and the function then sets it->key and it->value to
NULL.  Also false when it is NULL.

Removing the current member with cyaml_dictionary_remove(3) leaves
the cursor valid, but removing the successor or destroying the
dictionary doesn't.  cyaml_dictionary_first(3) lists every change and
its effect.

cyaml_dictionary_first(3), cyaml_dictionary_remove(3)