| Top |
| GMimeIterator * | g_mime_iterator_new () |
| GMimeIterator * | g_mime_iterator_new_for_entity () |
| GMimeMessage * | g_mime_iterator_get_message () |
| gboolean | g_mime_iterator_is_valid () |
| GMimeEntity * | g_mime_iterator_get_current () |
| GMimeEntity * | g_mime_iterator_get_parent () |
| char * | g_mime_iterator_get_path_specifier () |
| int | g_mime_iterator_get_depth () |
| int | g_mime_iterator_get_index () |
| GMimeMessage * | g_mime_iterator_get_current_message () |
| GMimeEntity * | g_mime_iterator_get_ancestor () |
| gboolean | g_mime_iterator_move_next () |
| void | g_mime_iterator_skip_children () |
| gboolean | g_mime_iterator_move_to () |
| void | g_mime_iterator_reset () |
Traverses a message's body, multipart children and encapsulated message
bodies in depth-first order, without visiting message objects themselves.
Newly created and reset iterators are positioned before the first entity.
Once exhausted, g_mime_iterator_move_next() returns FALSE until
g_mime_iterator_reset() or g_mime_iterator_move_to().
Path specifiers follow MimeKit's IMAP numbering: a message's single-part
body is part 1; multipart children are numbered from 1. A multipart body
has no part number of its own and is represented by a terminal 0.
g_mime_iterator_new_for_entity() traverses an entity subtree, including
its root, using the same numbering as if that root were a message body.
Paths and depths are relative to that root, not its containing message.
Traversal observes live collections. The iterator retains the message or root
and every entity in its current ancestry, keeping removed entities alive
until their frames are discarded. It does not snapshot or renumber frames
after external edits. Use g_mime_iterator_skip_children() to prune the
current subtree.
Cyclic MIME trees are not supported.
This GObject API ports MimeKit's MimeIterator and also supports entity roots. It does not provide backward traversal, editing, or cursor cloning.
GMimeIterator *
g_mime_iterator_new (GMimeMessage *message);
Creates an iterator positioned before the first entity. Retains message
.
GMimeIterator *
g_mime_iterator_new_for_entity (GMimeEntity *entity);
Creates an iterator positioned before entity
and retains it. Traversal
includes entity
and its descendants. Paths are relative to entity
:
a multipart root is "0", its children are "1", "2", etc.; any other root
is "1". The root has depth 0, index -1, and no parent.
The entity's containing message is not inferred. g_mime_iterator_get_message()
returns NULL, and g_mime_iterator_get_current_message() returns NULL unless
positioned inside an encapsulated message. If entity
is itself a
GMimeMessage, this is equivalent to g_mime_iterator_new(): traversal starts
at its live body, not the message object.
GMimeEntity *
g_mime_iterator_get_current (GMimeIterator *iter);
Requires a successful g_mime_iterator_move_next() or
g_mime_iterator_move_to() not followed by exhaustion or
g_mime_iterator_reset(). Use g_mime_iterator_is_valid() to check the state.
GMimeEntity *
g_mime_iterator_get_parent (GMimeIterator *iter);
char *
g_mime_iterator_get_path_specifier (GMimeIterator *iter);
GMimeMessage *
g_mime_iterator_get_current_message (GMimeIterator *iter);
GMimeEntity * g_mime_iterator_get_ancestor (GMimeIterator *iter,int generation);
iter |
a positioned GMimeIterator |
|
generation |
generations above the current entity, from 1 through depth |
gboolean
g_mime_iterator_move_next (GMimeIterator *iter);
Advances in depth-first order, descending into multipart children and
nonempty encapsulated message bodies unless g_mime_iterator_skip_children()
was requested.
Does not decode leaf content. Exhaustion releases the current ancestry.
void
g_mime_iterator_skip_children (GMimeIterator *iter);
Requests that the next g_mime_iterator_move_next() skip the current
entity's descendants. Has no effect on leaves. g_mime_iterator_reset()
and syntactically valid g_mime_iterator_move_to() calls cancel the request.
gboolean g_mime_iterator_move_to (GMimeIterator *iter,const char *path_specifier,GError **error);
Navigates directly to a path. Components are unsigned ASCII decimal
integers no greater than 2147483647, separated by dots; leading zeroes
are accepted. Invalid syntax sets GMIME_ERROR_PARSE_ERROR and preserves
the current position and pending skip. An empty or NULL path is a
programming error. A valid but nonexistent path exhausts the iterator
without an error. A valid path cancels a pending skip.
iter |
||
path_specifier |
a nonempty IMAP-style path specifier |
|
error |
return location for a GError. |
[nullable] |
void
g_mime_iterator_reset (GMimeIterator *iter);
Releases the current ancestry, cancels a pending skip and positions iter
before the first entity. The next g_mime_iterator_move_next() reads the
message's live body or revisits the retained entity root.