## CamelMimeFilter

CamelMimeFilter

## Synopsis

    struct              CamelMimeFilter;
    CamelMimeFilter *   camel_mime_filter_new               (void);
    void                camel_mime_filter_filter            (CamelMimeFilter *filter,
                                                             const gchar *in,
                                                             gsize len,
                                                             gsize prespace,
                                                             gchar **out,
                                                             gsize *outlen,
                                                             gsize *outprespace);
    void                camel_mime_filter_complete          (CamelMimeFilter *filter,
                                                             const gchar *in,
                                                             gsize len,
                                                             gsize prespace,
                                                             gchar **out,
                                                             gsize *outlen,
                                                             gsize *outprespace);
    void                camel_mime_filter_reset             (CamelMimeFilter *filter);
    void                camel_mime_filter_backup            (CamelMimeFilter *filter,
                                                             const gchar *data,
                                                             gsize length);
    void                camel_mime_filter_set_size          (CamelMimeFilter *filter,
                                                             gsize size,
                                                             gint keep);

## Object Hierarchy

      GObject
       +----CamelObject
             +----CamelMimeFilter
                   +----CamelMimeFilterBasic
                   +----CamelMimeFilterBestenc
                   +----CamelMimeFilterCanon
                   +----CamelMimeFilterCharset
                   +----CamelMimeFilterCRLF
                   +----CamelMimeFilterEnriched
                   +----CamelMimeFilterFrom
                   +----CamelMimeFilterGZip
                   +----CamelMimeFilterHTML
                   +----CamelMimeFilterIndex
                   +----CamelMimeFilterLinewrap
                   +----CamelMimeFilterPgp
                   +----CamelMimeFilterProgress
                   +----CamelMimeFilterSave
                   +----CamelMimeFilterToHTML
                   +----CamelMimeFilterWindows
                   +----CamelMimeFilterYenc

## Description

## Details

### struct CamelMimeFilter

    struct CamelMimeFilter;

### camel_mime_filter_new ()

    CamelMimeFilter *   camel_mime_filter_new               (void);

Create a new CamelMimeFilter object.

Returns : | a new CamelMimeFilter

### camel_mime_filter_filter ()

    void                camel_mime_filter_filter            (CamelMimeFilter *filter,
                                                             const gchar *in,
                                                             gsize len,
                                                             gsize prespace,
                                                             gchar **out,
                                                             gsize *outlen,
                                                             gsize *outprespace);

Passes the input buffer, `in`, through `filter` and generates an output buffer, `out`.

`filter` : | a CamelMimeFilter object
`in` : | input buffer
`len` : | length of `in`
`prespace` : | amount of prespace
`out` : | pointer to the output buffer (to be set)
`outlen` : | pointer to the length of the output buffer (to be set)
`outprespace` : | pointer to the output prespace length (to be set)

### camel_mime_filter_complete ()

    void                camel_mime_filter_complete          (CamelMimeFilter *filter,
                                                             const gchar *in,
                                                             gsize len,
                                                             gsize prespace,
                                                             gchar **out,
                                                             gsize *outlen,
                                                             gsize *outprespace);

Passes the input buffer, `in`, through `filter` and generates an output buffer, `out` and makes sure that all data is flushed to the output buffer. This must be the last filtering call made, no further calls to `camel_mime_filter_filter()` may be called on `filter` until `filter` has been reset using `camel_mime_filter_reset()`.

`filter` : | a CamelMimeFilter object
`in` : | input buffer
`len` : | length of `in`
`prespace` : | amount of prespace
`out` : | pointer to the output buffer (to be set)
`outlen` : | pointer to the length of the output buffer (to be set)
`outprespace` : | pointer to the output prespace length (to be set)

### camel_mime_filter_reset ()

    void                camel_mime_filter_reset             (CamelMimeFilter *filter);

Resets the state on `filter` so that it may be used again.

`filter` : | a CamelMimeFilter object

### camel_mime_filter_backup ()

    void                camel_mime_filter_backup            (CamelMimeFilter *filter,
                                                             const gchar *data,
                                                             gsize length);

Saves `data` to be used as prespace input data to the next call to `camel_mime_filter_filter()` or `camel_mime_filter_complete()`.

Note: New calls replace old data.

`filter` : | a CamelMimeFilter object
`data` : | data buffer to backup
`length` : | length of `data`

### camel_mime_filter_set_size ()

    void                camel_mime_filter_set_size          (CamelMimeFilter *filter,
                                                             gsize size,
                                                             gint keep);

Ensure that `filter` has enough storage space to store `size` bytes for filter output.

`filter` : | a CamelMimeFilter object
`size` : | requested amount of storage space
`keep` : | `TRUE` to keep existing buffered data or `FALSE` otherwise