LangTag.Iter

Fields

None

Methods

class

init (tmpl)

finish ()

next (key, val)

ref ()

unref ()

Details

class LangTag.Iter

All the fields in the LangTag.Iter structure are private to the LangTag.Iter implementation.

classmethod init(tmpl)
Parameters:

tmpl (LangTag.IterTmpl) – a #LtItermpl_t

Returns:

the initialized iterator object.

Return type:

LangTag.Iter

Initialize the iterator with tmpl object. this function has to be called before performing any opperation with the iterator and LangTag.Iter.finish() when the iterator isn’t needed anymore.

lt_lang_db *lang = lt_lang_db_new();
LtPointer *key, *val;
LtIter *iter;

iter = LT_ITER_INIT (lang);
while (lt_iter_next(iter, &key, &val)) {
  /* do something with key and value */
}
lt_iter_finish(iter);
finish()

Finalize the iterator and free its memory.

next(key, val)
Parameters:
Returns:

False if the end of the object that the iterator is adapted has been reached.

Return type:

int

Advances self 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.

ref()
Returns:

the same self object.

Return type:

LangTag.Iter

Increases the reference count of self.

unref()

Decreases the reference count of self. when its reference count drops to 0, the object is finalized (i.e. its memory is freed).