## as-utils as-utils — Helper functions that are used inside libappstream-glib |

## Stability Level

Stable, unless otherwise indicated

## Functions

gchar * | as_markup_convert_simple ()
gboolean | as_utils_is_stock_icon_name ()
gboolean | as_utils_is_spdx_license_id ()
const gchar * const * | as_util_get_possible_kudos ()
gchar ** | as_utils_spdx_license_tokenize ()
gboolean | as_utils_check_url_exists ()

## Object Hierarchy

## Includes

    #include <appstream-glib.h>

## Description

These functions are used internally to libappstream-glib, and some may be useful to user-applications.

## Functions

### as_markup_convert_simple ()

    gchar *
    as_markup_convert_simple (const gchar *markup,
                              gssize markup_len,
                              GError **error);

Converts an XML description into a printable form.

#### Parameters

markup | the text to copy. |
markup_len | the length of `markup` , or -1 if `markup` is NULL terminated. |
error | A GError or `NULL` |

#### Returns

a newly allocated `NULL` terminated string.

[transfer full]

Since 0.1.0

### as_utils_is_stock_icon_name ()

    gboolean
    as_utils_is_stock_icon_name (const gchar *name);

Searches the known list of stock icons.

#### Parameters

name | an icon name |

#### Returns

`TRUE` if the icon is a "stock icon name" and does not need to be included in the AppStream icon tarball

Since 0.1.3

### as_utils_is_spdx_license_id ()

    gboolean
    as_utils_is_spdx_license_id (const gchar *license_id);

Searches the known list of SPDX license IDs.

#### Parameters

license_id | a single SPDX license ID, e.g. "CC-BY-3.0" |

#### Returns

`TRUE` if the icon is a valid "SPDX license ID"

Since 0.1.5

### as_util_get_possible_kudos ()

    const gchar * const *
    as_util_get_possible_kudos (void);

Returns a list of all known kudos, which are metadata values that infer a level of integration or quality.

#### Returns

a static list of possible metadata keys

Since 0.1.4

### as_utils_spdx_license_tokenize ()

    gchar **
    as_utils_spdx_license_tokenize (const gchar *license);

Tokenizes the SPDX license string (or any simarly formatted string) into parts. Any non-licence parts of the string e.g. " and " are prefexed with "#".

#### Parameters

license | a license string, e.g. "LGPLv2+ and (QPL or GPLv2) and MIT" |

#### Returns

array of strings.

[transfer full]

Since 0.1.5

### as_utils_check_url_exists ()

    gboolean
    as_utils_check_url_exists (const gchar *url,
                               guint timeout,
                               GError **error);

Checks to see if a URL is reachable.

#### Parameters

url | the URL to check. |
timeout | the timeout in seconds. |
error | A GError or `NULL` |

#### Returns

`TRUE` if the URL was reachable and pointed to a non-zero-length file.

Since 0.1.5

## Types and Values