gsequence.h File Reference

__G_SEQUENCE_H__

Typedef GSequence

typedef typedefG_BEGIN_DECLS struct _GSequenceGSequence

Typedef GSequenceIter

typedef struct _GSequenceNodeGSequenceIter

Typedef GSequenceIterCompareFunc

typedef gint(*GSequenceIterCompareFunc

g_sequence_new ( GDestroyNotify )

IMPORT_C GSequence *g_sequence_new(GDestroyNotifydata_destroy)

g_sequence_new: : a GDestroyNotify function, or NULL

Creates a new GSequence. The function, if non-NULL will be called on all items when the sequence is destroyed and on items that are removed from the sequence.

Return value: a new GSequence

Since: 2.14

g_sequence_free ( GSequence * )

IMPORT_C voidg_sequence_free(GSequence *seq)

g_sequence_free: : a GSequence

Frees the memory allocated for . If has a data destroy function associated with it, that function is called on all items in .

Since: 2.14

g_sequence_get_length ( GSequence * )

IMPORT_C gintg_sequence_get_length(GSequence *seq)

g_sequence_get_length: : a GSequence

Returns the length of

Return value: the length of

Since: 2.14

g_sequence_foreach ( GSequence *, GFunc, gpointer )

IMPORT_C voidg_sequence_foreach(GSequence *seq,
GFuncfunc,
gpointeruser_data
)

g_sequence_foreach: : a GSequence : the function to call for each item in : user data passed to

Calls for each item in the sequence passing to the function.

Since: 2.14

g_sequence_foreach_range ( GSequenceIter *, GSequenceIter *, GFunc, gpointer )

IMPORT_C voidg_sequence_foreach_range(GSequenceIter *begin,
GSequenceIter *end,
GFuncfunc,
gpointeruser_data
)

g_sequence_foreach_range: : a GSequenceIter : a GSequenceIter : a GFunc : user data passed to

Calls for each item in the range (, ) passing to the function.

Since: 2.14

g_sequence_sort ( GSequence *, GCompareDataFunc, gpointer )

IMPORT_C voidg_sequence_sort(GSequence *seq,
GCompareDataFunccmp_func,
gpointercmp_data
)

g_sequence_sort: : a GSequence : the GCompareDataFunc used to sort . This function is passed two items of and should return 0 if they are equal, a negative value fi the first comes before the second, and a positive value if the second comes before the first. : user data passed to

Sorts using .

Since: 2.14

g_sequence_sort_iter ( GSequence *, GSequenceIterCompareFunc, gpointer )

IMPORT_C voidg_sequence_sort_iter(GSequence *seq,
GSequenceIterCompareFunccmp_func,
gpointercmp_data
)

g_sequence_sort_iter: : a GSequence : the #GSequenceItercompare used to compare iterators in the sequence. It is called with two iterators pointing into . It should return 0 if the iterators are equal, a negative value if the first iterator comes before the second, and a positive value if the second iterator comes before the first. : user data passed to

Like g_sequence_sort(), but uses a GSequenceIterCompareFunc instead of a GCompareDataFunc as the compare function

Since: 2.14

g_sequence_get_begin_iter ( GSequence * )

IMPORT_C GSequenceIter *g_sequence_get_begin_iter(GSequence *seq)

g_sequence_get_begin_iter: : a GSequence

Returns the begin iterator for .

Return value: the begin iterator for .

Since: 2.14

g_sequence_get_end_iter ( GSequence * )

IMPORT_C GSequenceIter *g_sequence_get_end_iter(GSequence *seq)

g_sequence_get_end_iter: : a GSequence

Returns the end iterator for

Return value: the end iterator for

Since: 2.14

g_sequence_get_iter_at_pos ( GSequence *, gint )

IMPORT_C GSequenceIter *g_sequence_get_iter_at_pos(GSequence *seq,
gintpos
)

g_sequence_get_iter_at_pos: : a GSequence : a position in , or -1 for the end.

Returns the iterator at position . If is negative or larger than the number of items in , the end iterator is returned.

Return value: The GSequenceIter at position

Since: 2.14

g_sequence_append ( GSequence *, gpointer )

IMPORT_C GSequenceIter *g_sequence_append(GSequence *seq,
gpointerdata
)

g_sequence_append: : a #GSequencePointer : the data for the new item

Adds a new item to the end of .

Return value: an iterator pointing to the new item

Since: 2.14

g_sequence_prepend ( GSequence *, gpointer )

IMPORT_C GSequenceIter *g_sequence_prepend(GSequence *seq,
gpointerdata
)

g_sequence_prepend: : a GSequence : the data for the new item

Adds a new item to the front of

Return value: an iterator pointing to the new item

Since: 2.14

g_sequence_insert_before ( GSequenceIter *, gpointer )

IMPORT_C GSequenceIter *g_sequence_insert_before(GSequenceIter *iter,
gpointerdata
)

g_sequence_insert_before: : a GSequenceIter : the data for the new item

Inserts a new item just before the item pointed to by .

Return value: an iterator pointing to the new item

Since: 2.14

g_sequence_move ( GSequenceIter *, GSequenceIter * )

IMPORT_C voidg_sequence_move(GSequenceIter *src,
GSequenceIter *dest
)

g_sequence_move: : a GSequenceIter pointing to the item to move : a GSequenceIter pointing to the position to which the item is moved.

Moves the item pointed to by to the position indicated by . After calling this function will point to the position immediately after . It is allowed for and to point into different sequences.

Since: 2.14

g_sequence_swap ( GSequenceIter *, GSequenceIter * )

IMPORT_C voidg_sequence_swap(GSequenceIter *a,
GSequenceIter *b
)

g_sequence_swap: : a GSequenceIter : a GSequenceIter

Swaps the items pointed to by and . It is allowed for and to point into difference sequences.

Since: 2.14

g_sequence_insert_sorted ( GSequence *, gpointer, GCompareDataFunc, gpointer )

IMPORT_C GSequenceIter *g_sequence_insert_sorted(GSequence *seq,
gpointerdata,
GCompareDataFunccmp_func,
gpointercmp_data
)

g_sequence_insert_sorted: : a GSequence : the data to insert : the GCompareDataFunc used to compare items in the sequence. It is called with two items of the and . It should return 0 if the items are equal, a negative value if the first item comes before the second, and a positive value if the second item comes before the first. : user data passed to .

Inserts into using to determine the new position. The sequence must already be sorted according to ; otherwise the new position of is undefined.

Return value: a GSequenceIter pointing to the new item.

Since: 2.14

g_sequence_insert_sorted_iter ( GSequence *, gpointer, GSequenceIterCompareFunc, gpointer )

IMPORT_C GSequenceIter *g_sequence_insert_sorted_iter(GSequence *seq,
gpointerdata,
GSequenceIterCompareFunciter_cmp,
gpointercmp_data
)

g_sequence_insert_sorted_iter: : a GSequence : data for the new item : the #GSequenceItercompare used to compare iterators in the sequence. It is called with two iterators pointing into . It should return 0 if the iterators are equal, a negative value if the first iterator comes before the second, and a positive value if the second iterator comes before the first. : user data passed to

Like g_sequence_insert_sorted(), but uses a GSequenceIterCompareFunc instead of a GCompareDataFunc as the compare function.

Return value: a GSequenceIter pointing to the new item

Since: 2.14

g_sequence_sort_changed ( GSequenceIter *, GCompareDataFunc, gpointer )

IMPORT_C voidg_sequence_sort_changed(GSequenceIter *iter,
GCompareDataFunccmp_func,
gpointercmp_data
)

g_sequence_sort_changed: : A GSequenceIter : the GCompareDataFunc used to compare items in the sequence. It is called with two items of the and . It should return 0 if the items are equal, a negative value if the first item comes before the second, and a positive value if the second item comes before the first. : user data passed to .

Moves the data pointed to a new position as indicated by . This function should be called for items in a sequence already sorted according to whenever some aspect of an item changes so that may return different values for that item.

Since: 2.14

g_sequence_sort_changed_iter ( GSequenceIter *, GSequenceIterCompareFunc, gpointer )

IMPORT_C voidg_sequence_sort_changed_iter(GSequenceIter *iter,
GSequenceIterCompareFunciter_cmp,
gpointercmp_data
)

g_sequence_sort_changed_iter: : a GSequenceIter : the #GSequenceItercompare used to compare iterators in the sequence. It is called with two iterators pointing into . It should return 0 if the iterators are equal, a negative value if the first iterator comes before the second, and a positive value if the second iterator comes before the first. : user data passed to

Like g_sequence_sort_changed(), but uses a GSequenceIterCompareFunc instead of a GCompareDataFunc as the compare function.

Since: 2.14

g_sequence_remove ( GSequenceIter * )

IMPORT_C voidg_sequence_remove(GSequenceIter *iter)

g_sequence_remove: : a GSequenceIter

Removes the item pointed to by . It is an error to pass the end iterator to this function.

If the sequnce has a data destroy function associated with it, this function is called on the data for the removed item.

Since: 2.14

g_sequence_remove_range ( GSequenceIter *, GSequenceIter * )

IMPORT_C voidg_sequence_remove_range(GSequenceIter *begin,
GSequenceIter *end
)

g_sequence_remove_range: : a GSequenceIter : a GSequenceIter

Removes all items in the (, ) range.

If the sequence has a data destroy function associated with it, this function is called on the data for the removed items.

Since: 2.14

g_sequence_move_range ( GSequenceIter *, GSequenceIter *, GSequenceIter * )

IMPORT_C voidg_sequence_move_range(GSequenceIter *dest,
GSequenceIter *begin,
GSequenceIter *end
)

g_sequence_move_range: : a GSequenceIter : a GSequenceIter : a GSequenceIter

Inserts the (, ) range at the destination pointed to by ptr. The and iters must point into the same sequence. It is allowed for to point to a different sequence than the one pointed into by and .

If is NULL, the range indicated by and is removed from the sequence. If iter points to a place within the (, ) range, the range does not move.

Since: 2.14

g_sequence_search ( GSequence *, gpointer, GCompareDataFunc, gpointer )

IMPORT_C GSequenceIter *g_sequence_search(GSequence *seq,
gpointerdata,
GCompareDataFunccmp_func,
gpointercmp_data
)

g_sequence_search: : a GSequence : data for the new item : the GCompareDataFunc used to compare items in the sequence. It is called with two items of the and . It should return 0 if the items are equal, a negative value if the first item comes before the second, and a positive value if the second item comes before the first. : user data passed to .

Returns an iterator pointing to the position where would be inserted according to and .

Return value: an GSequenceIter pointing to the position where would have been inserted according to and .

Since: 2.14

g_sequence_search_iter ( GSequence *, gpointer, GSequenceIterCompareFunc, gpointer )

IMPORT_C GSequenceIter *g_sequence_search_iter(GSequence *seq,
gpointerdata,
GSequenceIterCompareFunciter_cmp,
gpointercmp_data
)

g_sequence_search_iter: : a GSequence : data for the new item : the #GSequenceIterCompare function used to compare iterators in the sequence. It is called with two iterators pointing into . It should return 0 if the iterators are equal, a negative value if the first iterator comes before the second, and a positive value if the second iterator comes before the first. : user data passed to

Like g_sequence_search(), but uses a GSequenceIterCompareFunc instead of a GCompareDataFunc as the compare function.

Return value: a GSequenceIter pointing to the position in where would have been inserted according to and .

Since: 2.14

g_sequence_get ( GSequenceIter * )

IMPORT_C gpointerg_sequence_get(GSequenceIter *iter)

g_sequence_get: : a GSequenceIter

Returns the data that points to.

Return value: the data that points to

Since: 2.14

g_sequence_set ( GSequenceIter *, gpointer )

IMPORT_C voidg_sequence_set(GSequenceIter *iter,
gpointerdata
)

g_sequence_set: : a GSequenceIter : new data for the item

Changes the data for the item pointed to by to be . If the sequence has a data destroy function associated with it, that function is called on the existing data that pointed to.

Since: 2.14

g_sequence_iter_is_begin ( GSequenceIter * )

IMPORT_C gbooleang_sequence_iter_is_begin(GSequenceIter *iter)

g_sequence_iter_is_begin: : a GSequenceIter

Returns whether is the begin iterator

Return value: whether is the begin iterator

Since: 2.14

g_sequence_iter_is_end ( GSequenceIter * )

IMPORT_C gbooleang_sequence_iter_is_end(GSequenceIter *iter)

g_sequence_iter_is_end: : a GSequenceIter

Returns whether is the end iterator

Return value: Whether is the end iterator.

Since: 2.14

g_sequence_iter_next ( GSequenceIter * )

IMPORT_C GSequenceIter *g_sequence_iter_next(GSequenceIter *iter)

g_sequence_iter_next: : a GSequenceIter

Returns an iterator pointing to the next position after . If is the end iterator, the end iterator is returned.

Return value: a GSequenceIter pointing to the next position after .

Since: 2.14

g_sequence_iter_prev ( GSequenceIter * )

IMPORT_C GSequenceIter *g_sequence_iter_prev(GSequenceIter *iter)

g_sequence_iter_prev: : a GSequenceIter

Returns an iterator pointing to the previous position before . If is the begin iterator, the begin iterator is returned.

Return value: a GSequenceIter pointing to the previous position before .

Since: 2.14

g_sequence_iter_get_position ( GSequenceIter * )

IMPORT_C gintg_sequence_iter_get_position(GSequenceIter *iter)

g_sequence_iter_get_position: : a GSequenceIter

Returns the position of

Return value: the position of

Since: 2.14

g_sequence_iter_move ( GSequenceIter *, gint )

IMPORT_C GSequenceIter *g_sequence_iter_move(GSequenceIter *iter,
gintdelta
)

g_sequence_iter_move: : a GSequenceIter : A positive or negative number indicating how many positions away from the returned GSequenceIter will be.

Returns the GSequenceIter which is positions away from . If is closer than - positions to the beginning of the sequence, the begin iterator is returned. If is closer than positions to the end of the sequence, the end iterator is returned.

Return value: a GSequenceIter which is positions away from .

Since: 2.14

g_sequence_iter_get_sequence ( GSequenceIter * )

IMPORT_C GSequence *g_sequence_iter_get_sequence(GSequenceIter *iter)

g_sequence_iter_get_sequence: : a GSequenceIter

Returns the GSequence that points into.

Return value: the GSequence that points into.

Since: 2.14

g_sequence_iter_compare ( GSequenceIter *, GSequenceIter * )

IMPORT_C gintg_sequence_iter_compare(GSequenceIter *a,
GSequenceIter *b
)

g_sequence_iter_compare: : a GSequenceIter : a GSequenceIter

Returns a negative number if comes before , 0 if they are equal, and a positive number if comes after .

The and iterators must point into the same sequence.

Return value: A negative number if comes before , 0 if they are equal, and a positive number if comes after .

Since: 2.14

g_sequence_range_get_midpoint ( GSequenceIter *, GSequenceIter * )

IMPORT_C GSequenceIter *g_sequence_range_get_midpoint(GSequenceIter *begin,
GSequenceIter *end
)

g_sequence_range_get_midpoint: : a GSequenceIter : a GSequenceIter

Finds an iterator somewhere in the range (, ). This iterator will be close to the middle of the range, but is not guaranteed to be <emphasis>exactly</emphasis> in the middle.

The and iterators must both point to the same sequence and must come before or be equal to in the sequence.

Return value: A GSequenceIter pointing somewhere in the (, ) range.

Since: 2.14