## GMimeFilter GMimeFilter — Abstract filter class |

## Synopsis

    struct              GMimeFilter;
    GMimeFilter *       g_mime_filter_copy                  (GMimeFilter *filter);
    void                g_mime_filter_filter                (GMimeFilter *filter,
                                                             char *inbuf,
                                                             size_t inlen,
                                                             size_t prespace,
                                                             char **outbuf,
                                                             size_t *outlen,
                                                             size_t *outprespace);
    void                g_mime_filter_complete              (GMimeFilter *filter,
                                                             char *inbuf,
                                                             size_t inlen,
                                                             size_t prespace,
                                                             char **outbuf,
                                                             size_t *outlen,
                                                             size_t *outprespace);
    void                g_mime_filter_reset                 (GMimeFilter *filter);
    void                g_mime_filter_backup                (GMimeFilter *filter,
                                                             const char *data,
                                                             size_t length);
    void                g_mime_filter_set_size              (GMimeFilter *filter,
                                                             size_t size,
                                                             gboolean keep);

## Object Hierarchy

      GObject
       +----GMimeFilter
             +----GMimeFilterBasic
             +----GMimeFilterBest
             +----GMimeFilterCharset
             +----GMimeFilterCRLF
             +----GMimeFilterEnriched
             +----GMimeFilterFrom
             +----GMimeFilterGZip
             +----GMimeFilterHTML
             +----GMimeFilterMd5
             +----GMimeFilterStrip
             +----GMimeFilterWindows
             +----GMimeFilterYenc

## Description

Stream filters are an efficient way of converting data from one format to another.

## Details

### struct GMimeFilter

    struct GMimeFilter;

Base class for filters used by GMimeStreamFilter.

### g_mime_filter_copy ()

    GMimeFilter *       g_mime_filter_copy                  (GMimeFilter *filter);

Copies `filter` into a new GMimeFilter object.

`filter` : | filter
Returns : | a duplicate of `filter`. [transfer full]

### g_mime_filter_filter ()

    void                g_mime_filter_filter                (GMimeFilter *filter,
                                                             char *inbuf,
                                                             size_t inlen,
                                                             size_t prespace,
                                                             char **outbuf,
                                                             size_t *outlen,
                                                             size_t *outprespace);

Filters the input data and writes it to `out`.

`filter` : | filter
`inbuf` : | input buffer. [array length=inlen][element-type guint8]
`inlen` : | input buffer length
`prespace` : | prespace buffer length
`outbuf` : | pointer to output buffer. [out][array length=outlen][element-type guint8][transfer none]
`outlen` : | pointer to output length. [out]
`outprespace` : | pointer to output prespace buffer length. [out]

### g_mime_filter_complete ()

    void                g_mime_filter_complete              (GMimeFilter *filter,
                                                             char *inbuf,
                                                             size_t inlen,
                                                             size_t prespace,
                                                             char **outbuf,
                                                             size_t *outlen,
                                                             size_t *outprespace);

Completes the filtering.

`filter` : | filter
`inbuf` : | input buffer. [array length=inlen][element-type guint8]
`inlen` : | input buffer length
`prespace` : | prespace buffer length
`outbuf` : | pointer to output buffer. [out][array length=outlen][element-type guint8][transfer none]
`outlen` : | pointer to output length. [out]
`outprespace` : | pointer to output prespace buffer length. [out]

### g_mime_filter_reset ()

    void                g_mime_filter_reset                 (GMimeFilter *filter);

Resets the filter.

`filter` : | a GMimeFilter object

### g_mime_filter_backup ()

    void                g_mime_filter_backup                (GMimeFilter *filter,
                                                             const char *data,
                                                             size_t length);

Sets number of bytes backed up on the input, new calls replace previous ones

`filter` : | filter
`data` : | data to backup. [array length=length][element-type guint8]
`length` : | length of `data`

### g_mime_filter_set_size ()

    void                g_mime_filter_set_size              (GMimeFilter *filter,
                                                             size_t size,
                                                             gboolean keep);

Ensure this much size is available for filter output (if required)

`filter` : | filter
`size` : | requested size for the output buffer
`keep` : | `TRUE` if existing data in the output buffer should be kept

## See Also

GMimeStreamFilter