![]() |
![]() |
![]() |
Anjuta Developers Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <libanjuta/interfaces/ianjuta-iterable.h> #define IANJUTA_ITERABLE_ERROR struct IAnjutaIterableIface; void ianjuta_iterable_assign (IAnjutaIterable *obj
,IAnjutaIterable *src_iter
,GError **err
); IAnjutaIterable * ianjuta_iterable_clone (IAnjutaIterable *obj
,GError **err
); gint ianjuta_iterable_compare (IAnjutaIterable *obj
,IAnjutaIterable *iter2
,GError **err
); gint ianjuta_iterable_diff (IAnjutaIterable *obj
,IAnjutaIterable *iter2
,GError **err
); GQuark ianjuta_iterable_error_quark (void
); gboolean ianjuta_iterable_first (IAnjutaIterable *obj
,GError **err
); void ianjuta_iterable_foreach (IAnjutaIterable *obj
,GFunc callback
,gpointer user_data
,GError **err
); gint ianjuta_iterable_get_length (IAnjutaIterable *obj
,GError **err
); gint ianjuta_iterable_get_position (IAnjutaIterable *obj
,GError **err
); gboolean ianjuta_iterable_last (IAnjutaIterable *obj
,GError **err
); gboolean ianjuta_iterable_next (IAnjutaIterable *obj
,GError **err
); gboolean ianjuta_iterable_previous (IAnjutaIterable *obj
,GError **err
); gboolean ianjuta_iterable_set_position (IAnjutaIterable *obj
,gint position
,GError **err
);
struct IAnjutaIterableIface { GTypeInterface g_iface; void (*assign) (IAnjutaIterable *obj, IAnjutaIterable *src_iter, GError **err); IAnjutaIterable * (*clone) (IAnjutaIterable *obj, GError **err); gint (*compare) (IAnjutaIterable *obj, IAnjutaIterable *iter2, GError **err); gint (*diff) (IAnjutaIterable *obj, IAnjutaIterable *iter2, GError **err); gboolean (*first) (IAnjutaIterable *obj, GError **err); void (*foreach) (IAnjutaIterable *obj, GFunc callback, gpointer user_data, GError **err); gint (*get_length) (IAnjutaIterable *obj, GError **err); gint (*get_position) (IAnjutaIterable *obj, GError **err); gboolean (*last) (IAnjutaIterable *obj, GError **err); gboolean (*next) (IAnjutaIterable *obj, GError **err); gboolean (*previous) (IAnjutaIterable *obj, GError **err); gboolean (*set_position) (IAnjutaIterable *obj, gint position, GError **err); };
void ianjuta_iterable_assign (IAnjutaIterable *obj
,IAnjutaIterable *src_iter
,GError **err
);
Assigns the iter position from src_iter
.
|
Self |
|
Source iter from which to copy the assignment. |
|
Error propagation and reporting |
IAnjutaIterable * ianjuta_iterable_clone (IAnjutaIterable *obj
,GError **err
);
Clones the iterable. The returned iterable object must be unreffed when done.
|
Self |
|
Error propagation and reporting |
Returns : |
A new instance of this iterable pointing at the same location. [transfer full] |
gint ianjuta_iterable_compare (IAnjutaIterable *obj
,IAnjutaIterable *iter2
,GError **err
);
Compares the position of iter2
with this obj
. Returns -1
value if this obj
is smaller than iter2
. Returns +1 value
if this obj
is larger than iter2
. And returns 0 if both are equal.
If you want difference of the iter positions, use
#ianjuta_iterable_diff()
. This method is meant for fast comparision.
|
Self |
|
Second iter to compare. |
|
Error propagation and reporting |
Returns : |
0 if equal, -1 if obj is smaller than iter2
or +1 if obj is larger than iter2 . |
gint ianjuta_iterable_diff (IAnjutaIterable *obj
,IAnjutaIterable *iter2
,GError **err
);
Compares the position of iter2
with this obj
and returns difference
in position of the two (obj
- iter2
).
|
Self |
|
Second iter to differenciate. |
|
Error propagation and reporting |
Returns : |
The position difference of obj - iter2
|
gboolean ianjuta_iterable_first (IAnjutaIterable *obj
,GError **err
);
Set iter to first element position. Returns FALSE if there is no element in the iterable (hence does not have first). The iter points to the first valid item.
|
Self |
|
Error propagation and reporting |
Returns : |
TRUE if sucessful, other FALSE. |
void ianjuta_iterable_foreach (IAnjutaIterable *obj
,GFunc callback
,gpointer user_data
,GError **err
);
Call callback for each element in the list. Call back is passed the same iter, but with different position set (from first to last). This method does not affect current position. i.e. current position is restored at the end of this method.
|
Self |
|
Callback to call for each element. |
|
user data that is passed back to the callback. |
|
Error propagation and reporting |
gint ianjuta_iterable_get_length (IAnjutaIterable *obj
,GError **err
);
Length of the iterable (number of elements indexable by it).
|
Self |
|
Error propagation and reporting |
Returns : |
total length of the list. |
gint ianjuta_iterable_get_position (IAnjutaIterable *obj
,GError **err
);
Index of the current iter in the iterable. It will be
from 0 to length - 1 (ianjuta_iter_get_length()
) if iter is pointed
at valid element. It will return -1 if iter is pointed at end-iter.
|
Self |
|
Error propagation and reporting |
Returns : |
integer index, or -1 for end-iter. |
gboolean ianjuta_iterable_last (IAnjutaIterable *obj
,GError **err
);
Set iter position to end-iter (one past last element) position. Returns FALSE if there is no element in the iterable (already at end-iter).
|
Self |
|
Error propagation and reporting |
Returns : |
TRUE if sucessful, other FALSE. |
gboolean ianjuta_iterable_next (IAnjutaIterable *obj
,GError **err
);
Set the iter position to next element position. Iter can go until one item past the last item and lands in end-iter. end-iter does not point to any valid item and signifies end of the list. Returns FALSE if iter was already at end-iter (iter can not go past it) and remains pointed to the end-iter.
|
Self |
|
Error propagation and reporting |
Returns : |
TRUE if sucessful, otherwise FALSE if already at end-iter. |
gboolean ianjuta_iterable_previous (IAnjutaIterable *obj
,GError **err
);
Set the iter position to previous element position. Returns FALSE if there is no previous element and the iter remains pointed to the first element.
|
Self |
|
Error propagation and reporting |
Returns : |
TRUE if sucessful, other FALSE. |
gboolean ianjuta_iterable_set_position (IAnjutaIterable *obj
,gint position
,GError **err
);
Sets the current position of the iter to position
. The given position
must be from 0 to length - 1 (#ianjuta_iter_get_length()
) to point to
a valid element. Passing position
< 0 will set it to end-iter. It
returns TRUE for the above cases. FLASE will be returned, if
out-of-range position
is passed (position
> length - 1) and iter is
set to end-iter.
|
Self |
|
New position for the iter. |
|
Error propagation and reporting |
Returns : |
TRUE if successfully set (i.e. position is within the range or
end-iter). otherwise returns FALSE (i.e. position is out of data range). |