## GMimePartIter

GMimePartIter — MIME part iterators

## Functions

GMimePartIter * | g_mime_part_iter_new ()
void | g_mime_part_iter_free ()
GMimePartIter * | g_mime_part_iter_clone ()
void | g_mime_part_iter_reset ()
gboolean | g_mime_part_iter_jump_to ()
gboolean | g_mime_part_iter_is_valid ()
gboolean | g_mime_part_iter_next ()
gboolean | g_mime_part_iter_prev ()
GMimeObject * | g_mime_part_iter_get_toplevel ()
GMimeObject * | g_mime_part_iter_get_current ()
GMimeObject * | g_mime_part_iter_get_parent ()
char * | g_mime_part_iter_get_path ()
gboolean | g_mime_part_iter_replace ()
gboolean | g_mime_part_iter_remove ()

## Types and Values

| GMimePartIter

## Description

GMimePartIter is an iterator for traversing a GMimeObject tree in Depth-First order.

## Functions

### g_mime_part_iter_new ()

    GMimePartIter *
    g_mime_part_iter_new (GMimeObject *toplevel);

Creates a new GMimePartIter for iterating over `toplevel` 's subparts.

#### Parameters

toplevel | a GMimeObject to use as the toplevel |

#### Returns

a newly allocated GMimePartIter which should be freed using `g_mime_part_iter_free()` when finished with it.

### g_mime_part_iter_free ()

    void
    g_mime_part_iter_free (GMimePartIter *iter);

Frees the memory allocated by `g_mime_part_iter_new()`.

#### Parameters

iter | a GMimePartIter |

### g_mime_part_iter_clone ()

    GMimePartIter *
    g_mime_part_iter_clone (GMimePartIter *iter);

Clones the `iter` , including its current state.

#### Parameters

iter | a GMimePartIter |

#### Returns

a new GMimePartIter that is identical to `iter` .

[transfer full]

### g_mime_part_iter_reset ()

    void
    g_mime_part_iter_reset (GMimePartIter *iter);

Resets the state of `iter` to its initial state.

#### Parameters

iter | a GMimePartIter |

### g_mime_part_iter_jump_to ()

    gboolean
    g_mime_part_iter_jump_to (GMimePartIter *iter,
                              const char *path);

Updates the state of `iter` to point to the GMimeObject specified by `path` .

#### Parameters

iter | a GMimePartIter |
path | a string representing the path to jump to |

#### Returns

`TRUE` if the GMimeObject specified by `path` exists or `FALSE` otherwise.

### g_mime_part_iter_is_valid ()

    gboolean
    g_mime_part_iter_is_valid (GMimePartIter *iter);

Checks that the current state of `iter` is valid.

#### Parameters

iter | a GMimePartIter |

#### Returns

`TRUE` if `iter` is valid or `FALSE` otherwise.

### g_mime_part_iter_next ()

    gboolean
    g_mime_part_iter_next (GMimePartIter *iter);

Advances to the next part in the MIME structure used to initialize `iter` .

#### Parameters

iter | a GMimePartIter |

#### Returns

`TRUE` if successful or `FALSE` otherwise.

### g_mime_part_iter_prev ()

    gboolean
    g_mime_part_iter_prev (GMimePartIter *iter);

Rewinds to the previous part in the MIME structure used to initialize `iter` .

#### Parameters

iter | a GMimePartIter |

#### Returns

`TRUE` if successful or `FALSE` otherwise.

### g_mime_part_iter_get_toplevel ()

    GMimeObject *
    g_mime_part_iter_get_toplevel (GMimePartIter *iter);

Gets the toplevel GMimeObject used to initialize `iter` .

#### Parameters

iter | a GMimePartIter |

#### Returns

the toplevel GMimeObject.

[transfer none]

### g_mime_part_iter_get_current ()

    GMimeObject *
    g_mime_part_iter_get_current (GMimePartIter *iter);

Gets the GMimeObject at the current GMimePartIter position.

#### Parameters

iter | a GMimePartIter |

#### Returns

the current GMimeObject or `NULL` if the state of `iter` is invalid.

[transfer none]

### g_mime_part_iter_get_parent ()

    GMimeObject *
    g_mime_part_iter_get_parent (GMimePartIter *iter);

Gets the parent of the GMimeObject at the current GMimePartIter position.

#### Parameters

iter | a GMimePartIter |

#### Returns

the parent GMimeObject or `NULL` if the state of `iter` is invalid.

[transfer none]

### g_mime_part_iter_get_path ()

    char *
    g_mime_part_iter_get_path (GMimePartIter *iter);

Gets the path of the current GMimeObject in the MIME structure used to initialize `iter` .

#### Parameters

iter | a GMimePartIter |

#### Returns

a newly allocated string representation of the path to the GMimeObject at the current GMimePartIter position.

### g_mime_part_iter_replace ()

    gboolean
    g_mime_part_iter_replace (GMimePartIter *iter,
                              GMimeObject *replacement);

Replaces the GMimeObject at the current position with `replacement` .

#### Parameters

iter | a GMimePartIter |
replacement | a GMimeObject |

#### Returns

`TRUE` if the part at the current position was replaced or `FALSE` otherwise.

### g_mime_part_iter_remove ()

    gboolean
    g_mime_part_iter_remove (GMimePartIter *iter);

Removes the GMimeObject at the current position from its parent. If successful, `iter` is advanced to the next position (since the current position will become invalid).

#### Parameters

iter | a GMimePartIter |

#### Returns

`TRUE` if the part at the current position was removed or `FALSE` otherwise.

## Types and Values

### GMimePartIter

    typedef struct _GMimePartIter GMimePartIter;

A MIME part iterator.

## See Also

GMimeObject