## GMimeContentType GMimeContentType — Content-Type fields |

## Functions

GMimeContentType * | g_mime_content_type_new ()
GMimeContentType * | g_mime_content_type_parse ()
char * | g_mime_content_type_get_mime_type ()
char * | g_mime_content_type_encode ()
gboolean | g_mime_content_type_is_type ()
const char * | g_mime_content_type_get_media_type ()
void | g_mime_content_type_set_media_type ()
const char * | g_mime_content_type_get_media_subtype ()
void | g_mime_content_type_set_media_subtype ()
GMimeParamList * | g_mime_content_type_get_parameters ()
const char * | g_mime_content_type_get_parameter ()
void | g_mime_content_type_set_parameter ()

## Types and Values

struct | GMimeContentType

## Object Hierarchy

        GObject
        ╰── GMimeContentType

## Description

A GMimeContentType represents the pre-parsed contents of a Content-Type header field.

## Functions

### g_mime_content_type_new ()

    GMimeContentType *
    g_mime_content_type_new (const char *type,
                             const char *subtype);

Creates a Content-Type object with type `type` and subtype `subtype` .

#### Parameters

type | the MIME type or `NULL` for the default value |
subtype | the MIME subtype or `NULL` for the default value |

#### Returns

a new GMimeContentType object.

### g_mime_content_type_parse ()

    GMimeContentType *
    g_mime_content_type_parse (GMimeParserOptions *options,
                               const char *str);

Parses the input string into a GMimeContentType object.

#### Parameters

options | a GMimeParserOptions or `NULL`. | [nullable]
str | input string containing a content-type (and params) |

#### Returns

a new GMimeContentType object.

[transfer full]

### g_mime_content_type_get_mime_type ()

    char *
    g_mime_content_type_get_mime_type (GMimeContentType *content_type);

Allocates a string buffer containing the type and subtype defined by the `content_type` .

#### Parameters

content_type | a GMimeContentType |

#### Returns

an allocated string containing the type and subtype of the content-type in the format: type/subtype.

### g_mime_content_type_encode ()

    char *
    g_mime_content_type_encode (GMimeContentType *content_type,
                                GMimeFormatOptions *options);

Encodes the Content-Disposition header.

#### Parameters

content_type | a GMimeContentType |
options | a GMimeFormatOptions or `NULL`. | [nullable]

#### Returns

a new string containing the encoded header value.

### g_mime_content_type_is_type ()

    gboolean
    g_mime_content_type_is_type (GMimeContentType *content_type,
                                 const char *type,
                                 const char *subtype);

Compares the given type and subtype with that of the given mime type object.

#### Parameters

content_type | a GMimeContentType |
type | MIME type to compare against |
subtype | MIME subtype to compare against |

#### Returns

`TRUE` if the MIME types match or `FALSE` otherwise. You may use "*" in place of `type` and/or `subtype` as a wilcard.

### g_mime_content_type_get_media_type ()

    const char *
    g_mime_content_type_get_media_type (GMimeContentType *content_type);

Gets the Content-Type's media type.

#### Parameters

content_type | a GMimeContentType |

#### Returns

the Content-Type's media type.

### g_mime_content_type_set_media_type ()

    void
    g_mime_content_type_set_media_type (GMimeContentType *content_type,
                                        const char *type);

Sets the Content-Type's media type.

#### Parameters

content_type | a GMimeContentType |
type | media type |

### g_mime_content_type_get_media_subtype ()

    const char *
    g_mime_content_type_get_media_subtype (GMimeContentType *content_type);

Gets the Content-Type's media sub-type.

#### Parameters

content_type | a GMimeContentType |

#### Returns

the Content-Type's media sub-type.

### g_mime_content_type_set_media_subtype ()

    void
    g_mime_content_type_set_media_subtype (GMimeContentType *content_type,
                                           const char *subtype);

Sets the Content-Type's media subtype.

#### Parameters

content_type | a GMimeContentType |
subtype | media subtype |

### g_mime_content_type_get_parameters ()

    GMimeParamList *
    g_mime_content_type_get_parameters (GMimeContentType *content_type);

Gets the Content-Type's parameter list.

#### Parameters

content_type | a GMimeContentType |

#### Returns

the Content-Type's parameter list.

[transfer none]

### g_mime_content_type_get_parameter ()

    const char *
    g_mime_content_type_get_parameter (GMimeContentType *content_type,
                                       const char *name);

Gets the parameter value specified by `name` if it's available.

#### Parameters

content_type | a GMimeContentType |
name | parameter name (aka attribute) |

#### Returns

the value of the requested parameter or `NULL` if the parameter is not set. If the parameter is set, the returned string will be in UTF-8.

### g_mime_content_type_set_parameter ()

    void
    g_mime_content_type_set_parameter (GMimeContentType *content_type,
                                       const char *name,
                                       const char *value);

Sets a parameter on the Content-Type.

Note: The `name` should be in US-ASCII while the `value` should be in UTF-8.

#### Parameters

content_type | a GMimeContentType |
name | parameter name (aka attribute) |
value | parameter value |

## Types and Values

### struct GMimeContentType

    struct GMimeContentType;

A data structure representing a Content-Type.

#### Members