Container - Variant: liblangtag Documentation

## Container - Variant Container - Variant — A container class for Variant subtag |

## Functions

lt_variant_t * | lt_variant_ref ()
void | lt_variant_unref ()
const char * | lt_variant_get_better_tag ()
const char * | lt_variant_get_tag ()
const char * | lt_variant_get_preferred_tag ()
const char * | lt_variant_get_name ()
const lt_list_t * | lt_variant_get_prefix ()
void | lt_variant_dump ()
lt_bool_t | lt_variant_compare ()

## Types and Values

| lt_variant_t

## Description

This container class provides a data access to Variant subtag entry.

## Functions

### lt_variant_ref ()

    lt_variant_t *
    lt_variant_ref (lt_variant_t *variant);

Increases the reference count of `variant` .

#### Parameters

variant | a lt_variant_t. |

#### Returns

the same `variant` object.

[transfer none]

### lt_variant_unref ()

    void
    lt_variant_unref (lt_variant_t *variant);

Decreases the reference count of `variant` . when its reference count drops to 0, the object is finalized (i.e. its memory is freed).

#### Parameters

variant | a lt_variant_t. |

### lt_variant_get_better_tag ()

    const char *
    lt_variant_get_better_tag (const lt_variant_t *variant);

Obtains the better tag for use. this is a convenient function to get the preferred-value if available.

#### Parameters

variant | a lt_variant_t. |

#### Returns

a tag string.

### lt_variant_get_tag ()

    const char *
    lt_variant_get_tag (const lt_variant_t *variant);

Obtains the tag name.

#### Parameters

variant | a lt_variant_t. |

#### Returns

a tag string.

### lt_variant_get_preferred_tag ()

    const char *
    lt_variant_get_preferred_tag (const lt_variant_t *variant);

Obtains the preferred-value. this is available only when the tag is marked as deprecated.

#### Parameters

variant | a lt_variant_t. |

#### Returns

a preferred-value for the tag or `NULL`.

### lt_variant_get_name ()

    const char *
    lt_variant_get_name (const lt_variant_t *variant);

Obtains the description of the subtag.

#### Parameters

variant | a lt_variant_t. |

#### Returns

a description string.

### lt_variant_get_prefix ()

    const lt_list_t *
    lt_variant_get_prefix (const lt_variant_t *variant);

Obtains the prefix being assigned to the subtag. This is available only when the subtag has any suitable sequence of subtags for forming (with other subtags, as appropriate) a language tag when using the variant.

#### Parameters

variant | a lt_variant_t. |

#### Returns

a lt_list_t contains prefix strings or `NULL`.

[transfer none]

### lt_variant_dump ()

    void
    lt_variant_dump (const lt_variant_t *variant);

Dumps the container information to the standard output.

#### Parameters

variant | a lt_variant_t. |

### lt_variant_compare ()

    lt_bool_t
    lt_variant_compare (const lt_variant_t *v1,
                        const lt_variant_t *v2);

Compare if `v1` and `v2` is the same object or not.

#### Parameters

v1 | a lt_variant_t. |
v2 | a lt_variant_t. |

#### Returns

`TRUE` if it's the same, otherwise `FALSE`.

## Types and Values

### lt_variant_t

    typedef struct _lt_variant_t lt_variant_t;

All the fields in the lt_variant_t structure are private to the lt_variant_t implementation.