as-utils

as-utils — Helper functions that are used inside libappstream

Functions

Includes

#include <appstream.h>

Description

Functions which are used in libappstream and might be useful for others as well.

Functions

as_description_markup_convert_simple ()

gchar *
as_description_markup_convert_simple (const gchar *markup);

Converts an XML description markup into a simple printable form.

Parameters

markup

the text to copy.

 

Returns

a newly allocated NULL terminated string.

[transfer full]


as_get_current_locale ()

gchar *
as_get_current_locale (void);

Returns a locale string as used in the AppStream specification.

Returns

A locale string, free with g_free().

[transfer full]


as_str_empty ()

gboolean
as_str_empty (const gchar *str);

Test if a C string is NULL or empty (containing only spaces).

Parameters

str

The string to test.

 

as_iso8601_to_datetime ()

GDateTime *
as_iso8601_to_datetime (const gchar *iso_date);

Helper function to work around a bug in g_time_val_from_iso8601. Can be dropped when the bug gets resolved upstream: https://bugzilla.gnome.org/show_bug.cgi?id=760983


as_utils_locale_is_compatible ()

gboolean
as_utils_locale_is_compatible (const gchar *locale1,
                               const gchar *locale2);

Calculates if one locale is compatible with another. When doing the calculation the locale and language code is taken into account if possible.

Parameters

locale1

a locale string, or NULL

 

locale2

a locale string, or NULL

 

Returns

TRUE if the locale is compatible.

Since: 0.9.5


as_utils_is_category_name ()

gboolean
as_utils_is_category_name (const gchar *category_name);


as_utils_is_tld ()

gboolean
as_utils_is_tld (const gchar *tld);

Searches the known list of TLDs we allow for AppStream IDs. This excludes internationalized names.

Parameters

tld

a top-level domain without dot, e.g. "de", "org", "name"

 

Returns

TRUE if the TLD is valid

Since: 0.9.8

Types and Values