Wp.Iterator¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Wp.Iterator¶
A generic iterator API
- classmethod new(methods, user_size)¶
- Parameters:
methods (
Wp.IteratorMethods
) – method implementations for the new iteratoruser_size (
int
) – size of the user_data structure to be allocated
- Returns:
a new custom iterator
- Return type:
Constructs an iterator that uses the provided methods to implement its API.
The
Wp.Iterator
structure is internally allocated with user_size additional space at the end. A pointer to this space can be retrieved withWp.Iterator.get_user_data
() and is available for implementation-specific storage.
- fold(func, ret, *data)¶
- Parameters:
func (
Wp.IteratorFoldFunc
) – the fold functionret (
GObject.Value
) – the accumulator data
- Returns:
True
if all the items were processed,False
otherwise.- ret:
the accumulator data
- Return type:
(
bool
, ret:GObject.Value
)
Fold a function over the items of the iterator.
- foreach(func, *data)¶
- Parameters:
func (
Wp.IteratorForeachFunc
) – the foreach function
- Returns:
- Return type:
Iterates over all items of the iterator calling a function.
- get_user_data()¶
-
Gets the implementation-specific storage of an iterator.
this only for use by implementations of
Wp.Iterator
- next()¶
- Returns:
True
if next iterator was obtained,False
when the iterator has no more items to iterate through.- item:
the next item of the iterator
- Return type:
(
bool
, item:GObject.Value
)
Gets the next item of the iterator.
- ref()¶
- Returns:
self with an additional reference count on it
- Return type:
Increases the reference count of an iterator.
- reset()¶
Resets the iterator so we can iterate again from the beginning.
- unref()¶
Decreases the reference count on self and frees it when the ref count reaches zero.