CToon C 0.6.1
A C99 TOON/JSON serialization library
Loading...
Searching...
No Matches
ctoon_mut_obj_iter Struct Reference

#include <ctoon.h>

Collaboration diagram for ctoon_mut_obj_iter:

Data Fields

size_t idx
 
size_t max
 
ctoon_mut_valcur
 
ctoon_mut_valpre
 
ctoon_mut_valobj
 

Detailed Description

A mutable TOON object iterator.

Warning
You should not modify the object while iterating over it, but you can use ctoon_mut_obj_iter_remove() to remove current value.

Example

ctoon_mut_val *key, *val;
while ((key = ctoon_mut_obj_iter_next(&iter))) {
your_func(key, val);
if (your_val_is_unused(key, val)) {
}
}
static ctoon_mut_val * ctoon_mut_obj_iter_get_val(ctoon_mut_val *key)
Definition ctoon.h:6587
static ctoon_mut_val * ctoon_mut_obj_iter_remove(ctoon_mut_obj_iter *iter)
Definition ctoon.h:6592
static ctoon_mut_val * ctoon_mut_obj_iter_next(ctoon_mut_obj_iter *iter)
Definition ctoon.h:6575
static ctoon_mut_obj_iter ctoon_mut_obj_iter_with(ctoon_mut_val *obj)
Definition ctoon.h:6564
ctoon_mut_val * obj
Definition ctoon.h:3313

If the ordering of the keys is known at compile-time, you can use this method to speed up value lookups:

// {"k1":1, "k2": 3, "k3": 3}
ctoon_mut_val *key, *val;
static ctoon_mut_val * ctoon_mut_obj_iter_get(ctoon_mut_obj_iter *iter, const char *key)
Definition ctoon.h:6609
See also
ctoon_mut_obj_iter_get() and ctoon_mut_obj_iter_getn()

Definition at line 3308 of file ctoon.h.

Field Documentation

◆ cur

ctoon_mut_val* ctoon_mut_obj_iter::cur

current key

Definition at line 3311 of file ctoon.h.

◆ idx

size_t ctoon_mut_obj_iter::idx

next key's index

Definition at line 3309 of file ctoon.h.

◆ max

size_t ctoon_mut_obj_iter::max

maximum key index (obj.size)

Definition at line 3310 of file ctoon.h.

◆ obj

ctoon_mut_val* ctoon_mut_obj_iter::obj

the object being iterated

Definition at line 3313 of file ctoon.h.

◆ pre

ctoon_mut_val* ctoon_mut_obj_iter::pre

previous key

Definition at line 3312 of file ctoon.h.


The documentation for this struct was generated from the following file: