AsFormat: AppStream-glib Reference Manual

## AsFormat AsFormat — Object representing where information about a AsApp came from. |

## Stability Level

Stable, unless otherwise indicated

## Functions

AsFormat * | as_format_new ()
AsFormatKind | as_format_kind_from_string ()
const gchar * | as_format_kind_to_string ()
gboolean | as_format_equal ()
AsFormatKind | as_format_guess_kind ()
const gchar * | as_format_get_filename ()
AsFormatKind | as_format_get_kind ()
void | as_format_set_filename ()
void | as_format_set_kind ()

## Types and Values

#define | AS_TYPE_FORMAT
struct | AsFormatClass
enum | AsFormatKind
| AsFormat

## Includes

    #include <appstream-glib.h>

## Description

AsApp's may be made from several information formats, and this object represents the filename (and kind) of the format.

See also: AsApp

## Functions

### as_format_new ()

    AsFormat *
    as_format_new (void);

Creates a new AsFormat.

#### Returns

a AsFormat.

[transfer full]

Since: 0.6.9

### as_format_kind_from_string ()

    AsFormatKind
    as_format_kind_from_string (const gchar *kind);

Converts the text representation to an enumerated value.

#### Parameters

kind | the string. |

#### Returns

a AsFormatKind, or `AS_FORMAT_KIND_UNKNOWN` for unknown.

[transfer full]

Since: 0.6.9

### as_format_kind_to_string ()

    const gchar *
    as_format_kind_to_string (AsFormatKind kind);

### as_format_equal ()

    gboolean
    as_format_equal (AsFormat *format1,
                     AsFormat *format2);

Checks if two formats are the same.

#### Parameters

format1 | a AsFormat instance. |
format2 | a AsFormat instance. |

#### Returns

`TRUE` for success

Since: 0.6.9

### as_format_guess_kind ()

    AsFormatKind
    as_format_guess_kind (const gchar *filename);

Guesses the source kind based from the filename.

#### Parameters

filename | a file name |

#### Returns

A AsFormatKind, e.g. `AS_FORMAT_KIND_APPSTREAM`.

Since: 0.6.9

### as_format_get_filename ()

    const gchar *
    as_format_get_filename (AsFormat *format);

Gets the filename required for this format.

#### Parameters

format | a AsFormat instance. |

#### Returns

Runtime identifier, e.g. "org.gnome.Platform/i386/master"

Since: 0.6.9

### as_format_get_kind ()

    AsFormatKind
    as_format_get_kind (AsFormat *format);

Gets the format kind.

#### Parameters

format | a AsFormat instance. |

#### Returns

the AsFormatKind

Since: 0.6.9

### as_format_set_filename ()

    void
    as_format_set_filename (AsFormat *format,
                            const gchar *filename);

Sets the filename required for this format.

#### Parameters

format | a AsFormat instance. |
filename | the URL. |

Since: 0.6.9

### as_format_set_kind ()

    void
    as_format_set_kind (AsFormat *format,
                        AsFormatKind kind);

Sets the format kind.

#### Parameters

format | a AsFormat instance. |
kind | the AsFormatKind, e.g. `AS_FORMAT_KIND_APPDATA`. |

Since: 0.6.9

## Types and Values

### AS_TYPE_FORMAT

    #define AS_TYPE_FORMAT (as_format_get_type ())

### struct AsFormatClass

    struct AsFormatClass {
    	GObjectClass		parent_class;
    };

### enum AsFormatKind

The format kind.

#### Members

AS_FORMAT_KIND_UNKNOWN | Not formatd from a file |
AS_FORMAT_KIND_APPSTREAM | AppStream file |
AS_FORMAT_KIND_DESKTOP | Desktop file |
AS_FORMAT_KIND_APPDATA | AppData file |
AS_FORMAT_KIND_METAINFO | MetaInfo file |

### AsFormat

    typedef struct _AsFormat AsFormat;