|  |  |  | liblangtag Documentation |  | 
|---|---|---|---|---|
| Top | Description | ||||
#define LT_ITER_INIT (_obj_) void lt_iter_finish (lt_iter_t *iter); lt_iter_t * lt_iter_init (lt_iter_tmpl_t *tmpl); lt_bool_t lt_iter_next (lt_iter_t *iter,lt_pointer_t *key,lt_pointer_t *val); lt_iter_t * lt_iter_ref (lt_iter_t *iter); lt_iter_t; lt_iter_tmpl_t; void lt_iter_unref (lt_iter_t *iter);
This class provides a common interface to iterate over the key/value pairs in an initiated object.
#define LT_ITER_INIT(_obj_) lt_iter_init((lt_iter_tmpl_t *)(_obj_))
This is a convenient macro to call lt_iter_init().
| 
 | an object that initialize the iterator with. | 
| Returns : | a lt_iter_t. [transfer full] | 
void                lt_iter_finish                      (lt_iter_t *iter);
Finalize the iterator and free its memory.
| 
 | a lt_iter_t | 
lt_iter_t *         lt_iter_init                        (lt_iter_tmpl_t *tmpl);
Initialize the iterator with tmpl object. this function has to be called
before performing any opperation with the iterator and lt_iter_finish()
when the iterator isn't needed anymore.
| 1 2 3 4 5 6 7 8 9 | lt_lang_db *lang = lt_lang_db_new(); lt_pointer_t *key, *val; lt_iter_t *iter; iter = LT_ITER_INIT (lang); while (lt_iter_next(iter, &key, &val)) { /* do something with key and value */ } lt_iter_finish(iter); | 
| 
 | a lt_iter_tmpl_t | 
| Returns : | the initialized iterator object. [transfer none] | 
lt_bool_t lt_iter_next (lt_iter_t *iter,lt_pointer_t *key,lt_pointer_t *val);
Advances iter and retrieves the key and/or value that are now
pointed to as a result of this advancement. If FALSE is returned,
key and value are not set, and the iterator becomes invalid.
lt_iter_t *         lt_iter_ref                         (lt_iter_t *iter);
Increases the reference count of iter.
| 
 | a lt_iter_t | 
| Returns : | the same iterobject. [transfer none] | 
typedef struct _lt_iter_t lt_iter_t;
All the fields in the lt_iter_t structure are private to the lt_iter_t implementation.
typedef struct _lt_iter_tmpl_t lt_iter_tmpl_t;
All the fields in the lt_iter_tmpl_t structure are private to the lt_iter_tmpl_t implementation.