SequenceIter


Object Hierarchy:

Object hierarchy for SequenceIter

Description:

[ Compact ]
[ Version ( since = "2.14" ) ]
[ CCode ( ref_function = "" , unref_function = "" ) ]
public class SequenceIter<G>

The SequenceIter struct is an opaque data type representing an iterator pointing into a Sequence.

Example: Sequence, iter:

public static int main (string[] args) {
Sequence<string> seq = new Sequence<string> ();
seq.append ("Lorem");
seq.append ("ipsum");
seq.append ("dolor");
seq.append ("sit");
seq.append ("amet");

// Output:
// ``Lorem
// ``ipsum``
// ``dolor``
// ``sit``
// ``amet``
for (SequenceIter<string> iter = seq.get_begin_iter (); !iter.is_end (); iter = iter.next ()) {
print ("%d: %s\n", iter.get_position (), iter.get ());
}

// Output:
// ``amet``
// ``sit``
// ``dolor``
// ``ipsum``
// ``Lorem``
SequenceIter<string> iter = seq.get_end_iter ().prev ();
bool has_next = !iter.is_begin ();
while (has_next) {
print ("%d: %s\n", iter.get_position (), iter.get ());
has_next = !iter.is_begin ();
iter = iter.prev ();
}

return 0;
}

valac --pkg glib-2.0 GLib.SequenceIter.vala


Namespace: GLib
Package: glib-2.0

Content:

Methods: