as-enums

as-enums — Helper functions for converting to and from enum strings

Stability Level

Stable, unless otherwise indicated

Synopsis

#include <appstream-glib.h>

enum                AsIdKind;
enum                AsIconKind;
enum                AsUrlKind;
enum                AsKudoKind;
const gchar *       as_id_kind_to_string                (AsIdKind id_kind);
AsIdKind            as_id_kind_from_string              (const gchar *id_kind);
const gchar *       as_icon_kind_to_string              (AsIconKind icon_kind);
AsIconKind          as_icon_kind_from_string            (const gchar *icon_kind);
const gchar *       as_url_kind_to_string               (AsUrlKind url_kind);
AsUrlKind           as_url_kind_from_string             (const gchar *url_kind);
const gchar *       as_kudo_kind_to_string              (AsKudoKind kudo_kind);
AsKudoKind          as_kudo_kind_from_string            (const gchar *kudo_kind);

Description

These helper functions may be useful if implementing an AppStream parser.

Details

enum AsIdKind

typedef enum {
	AS_ID_KIND_UNKNOWN,		/* Since: 0.1.0 */
	AS_ID_KIND_DESKTOP,		/* Since: 0.1.0 */
	AS_ID_KIND_FONT,		/* Since: 0.1.0 */
	AS_ID_KIND_CODEC,		/* Since: 0.1.0 */
	AS_ID_KIND_INPUT_METHOD, /* Since: 0.1.0 */
	AS_ID_KIND_WEB_APP,		/* Since: 0.1.0 */
	AS_ID_KIND_SOURCE,		/* Since: 0.1.0 */
	AS_ID_KIND_ADDON,		/* Since: 0.1.7 */
} AsIdKind;

The ID type.

AS_ID_KIND_UNKNOWN

Type invalid or not known

AS_ID_KIND_DESKTOP

A desktop application

AS_ID_KIND_FONT

A font add-on

AS_ID_KIND_CODEC

A codec add-on

AS_ID_KIND_INPUT_METHOD

A input method add-on

AS_ID_KIND_WEB_APP

A web appication

AS_ID_KIND_SOURCE

A software source

AS_ID_KIND_ADDON

An addon, e.g. a plugin

enum AsIconKind

typedef enum {
	AS_ICON_KIND_UNKNOWN,		/* Since: 0.1.0 */
	AS_ICON_KIND_STOCK,		/* Since: 0.1.0 */
	AS_ICON_KIND_CACHED,		/* Since: 0.1.0 */
	AS_ICON_KIND_REMOTE,		/* Since: 0.1.0 */
} AsIconKind;

The icon type.

AS_ICON_KIND_UNKNOWN

Type invalid or not known

AS_ICON_KIND_STOCK

Stock icon or present in the generic icon theme

AS_ICON_KIND_CACHED

An icon shipped with the AppStream metadata

AS_ICON_KIND_REMOTE

An icon referenced by a remote URL

enum AsUrlKind

typedef enum {
	AS_URL_KIND_UNKNOWN,		/* Since: 0.1.0 */
	AS_URL_KIND_HOMEPAGE,		/* Since: 0.1.0 */
	AS_URL_KIND_BUGTRACKER,		/* Since: 0.1.1 */
	AS_URL_KIND_FAQ,		/* Since: 0.1.1 */
	AS_URL_KIND_DONATION,		/* Since: 0.1.1 */
	AS_URL_KIND_HELP,		/* Since: 0.1.5 */
	AS_URL_KIND_MISSING,		/* Since: 0.2.2 */
} AsUrlKind;

The URL type.

AS_URL_KIND_UNKNOWN

Type invalid or not known

AS_URL_KIND_HOMEPAGE

Application project homepage

AS_URL_KIND_BUGTRACKER

Application bugtracker

AS_URL_KIND_FAQ

Application FAQ page

AS_URL_KIND_DONATION

Application donation page

AS_URL_KIND_HELP

Application help manual

AS_URL_KIND_MISSING

The package is available, but missing

enum AsKudoKind

typedef enum {
	AS_KUDO_KIND_UNKNOWN,		/* Since: 0.2.2 */
	AS_KUDO_KIND_SEARCH_PROVIDER, /* Since: 0.2.2 */
	AS_KUDO_KIND_USER_DOCS, 	/* Since: 0.2.2 */
	AS_KUDO_KIND_APP_MENU,		/* Since: 0.2.2 */
	AS_KUDO_KIND_MODERN_TOOLKIT, /* Since: 0.2.2 */
	AS_KUDO_KIND_NOTIFICATIONS, /* Since: 0.2.2 */
} AsKudoKind;

The kudo type.

AS_KUDO_KIND_UNKNOWN

Type invalid or not known

AS_KUDO_KIND_SEARCH_PROVIDER

Installs a search provider

AS_KUDO_KIND_USER_DOCS

Installs user documentation

AS_KUDO_KIND_APP_MENU

Uses the GNOME application menu

AS_KUDO_KIND_MODERN_TOOLKIT

Uses a modern toolkit like GTK3 or QT5

AS_KUDO_KIND_NOTIFICATIONS

Registers notifications with KDE or GNOME

as_id_kind_to_string ()

const gchar *       as_id_kind_to_string                (AsIdKind id_kind);

Converts the enumerated value to an text representation.

id_kind :

the AsIdKind.

Returns :

string version of id_kind

Since 0.1.0


as_id_kind_from_string ()

AsIdKind            as_id_kind_from_string              (const gchar *id_kind);

Converts the text representation to an enumerated value.

id_kind :

the string.

Returns :

a AsIdKind or AS_ID_KIND_UNKNOWN for unknown

Since 0.1.0


as_icon_kind_to_string ()

const gchar *       as_icon_kind_to_string              (AsIconKind icon_kind);

Converts the enumerated value to an text representation.

icon_kind :

the AsIconKind.

Returns :

string version of icon_kind

Since 0.1.0


as_icon_kind_from_string ()

AsIconKind          as_icon_kind_from_string            (const gchar *icon_kind);

Converts the text representation to an enumerated value.

icon_kind :

the string.

Returns :

a AsIconKind or AS_ICON_KIND_UNKNOWN for unknown

Since 0.1.0


as_url_kind_to_string ()

const gchar *       as_url_kind_to_string               (AsUrlKind url_kind);

Converts the enumerated value to an text representation.

url_kind :

the AsUrlKind.

Returns :

string version of url_kind

Since 0.1.0


as_url_kind_from_string ()

AsUrlKind           as_url_kind_from_string             (const gchar *url_kind);

Converts the text representation to an enumerated value.

url_kind :

the string.

Returns :

a AsUrlKind or AS_URL_KIND_UNKNOWN for unknown

Since 0.1.0


as_kudo_kind_to_string ()

const gchar *       as_kudo_kind_to_string              (AsKudoKind kudo_kind);

Converts the enumerated value to an text representation.

kudo_kind :

the AsKudoKind.

Returns :

string version of kudo_kind

Since 0.2.2


as_kudo_kind_from_string ()

AsKudoKind          as_kudo_kind_from_string            (const gchar *kudo_kind);

Converts the text representation to an enumerated value.

kudo_kind :

the string.

Returns :

a AsKudoKind or AS_KUDO_KIND_UNKNOWN for unknown

Since 0.2.2