## AsContext

AsContext — Context of an AppStream metadata document

## Functions

const gchar * | as_format_version_to_string ()
AsFormatVersion | as_format_version_from_string ()
AsContext * | as_context_new ()
AsFormatVersion | as_context_get_format_version ()
void | as_context_set_format_version ()
AsFormatStyle | as_context_get_style ()
void | as_context_set_style ()
gint | as_context_get_priority ()
void | as_context_set_priority ()
const gchar * | as_context_get_origin ()
void | as_context_set_origin ()
const gchar * | as_context_get_locale ()
void | as_context_set_locale ()
gboolean | as_context_has_media_baseurl ()
const gchar * | as_context_get_media_baseurl ()
void | as_context_set_media_baseurl ()
gboolean | as_context_get_locale_all_enabled ()
const gchar * | as_context_get_filename ()
void | as_context_set_filename ()

## Types and Values

#define | AS_TYPE_CONTEXT
struct | AsContextClass
enum | AsFormatVersion
#define | AS_FORMAT_VERSION_CURRENT
| AsContext

## Includes

    #include <appstream.h>

## Description

Contains information about the context of AppStream metadata, from the root node of the document. Instances of AsContext may be shared between AsComponent instances.

You usually do not want to use this directly, but use the more convenient AsMetadata instead.

See also: AsComponent, AsMetadata

## Functions

### as_format_version_to_string ()

    const gchar *
    as_format_version_to_string (AsFormatVersion version);

Converts the enumerated value to an text representation.

#### Parameters

version | the AsFormatKind. |

#### Returns

string version of `version`

Since: 0.10

### as_format_version_from_string ()

    AsFormatVersion
    as_format_version_from_string (const gchar *version_str);

Converts the text representation to an enumerated value.

#### Parameters

version_str | the string. |

#### Returns

a AsFormatVersion. For unknown, the highest version number is assumed.

Since: 0.10

### as_context_new ()

    AsContext *
    as_context_new (void);

Creates a new AsContext.

#### Returns

an AsContext.

[transfer full]

### as_context_get_format_version ()

    AsFormatVersion
    as_context_get_format_version (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

The AppStream format version.

### as_context_set_format_version ()

    void
    as_context_set_format_version (AsContext *ctx,
                                   AsFormatVersion ver);

Sets the AppStream format version.

#### Parameters

ctx | a AsContext instance. |
ver | the new format version. |

### as_context_get_style ()

    AsFormatStyle
    as_context_get_style (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

The document style.

### as_context_set_style ()

    void
    as_context_set_style (AsContext *ctx,
                          AsFormatStyle style);

Sets the AppStream document style.

#### Parameters

ctx | a AsContext instance. |
style | the new document style. |

### as_context_get_priority ()

    gint
    as_context_get_priority (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

The data priority.

### as_context_set_priority ()

    void
    as_context_set_priority (AsContext *ctx,
                             gint priority);

Sets the data priority.

#### Parameters

ctx | a AsContext instance. |
priority | the new priority. |

### as_context_get_origin ()

    const gchar *
    as_context_get_origin (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

The data origin.

### as_context_set_origin ()

    void
    as_context_set_origin (AsContext *ctx,
                           const gchar *value);

Sets the data origin.

#### Parameters

ctx | a AsContext instance. |
value | the new value. |

### as_context_get_locale ()

    const gchar *
    as_context_get_locale (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

The active locale.

### as_context_set_locale ()

    void
    as_context_set_locale (AsContext *ctx,
                           const gchar *value);

Sets the active locale.

#### Parameters

ctx | a AsContext instance. |
value | the new value. |

### as_context_has_media_baseurl ()

    gboolean
    as_context_has_media_baseurl (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

`TRUE` if a media base URL is set.

### as_context_get_media_baseurl ()

    const gchar *
    as_context_get_media_baseurl (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

The media base URL.

### as_context_set_media_baseurl ()

    void
    as_context_set_media_baseurl (AsContext *ctx,
                                  const gchar *value);

Sets the media base URL.

#### Parameters

ctx | a AsContext instance. |
value | the new value. |

### as_context_get_locale_all_enabled ()

    gboolean
    as_context_get_locale_all_enabled (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

`TRUE` if all locale should be parsed.

### as_context_get_filename ()

    const gchar *
    as_context_get_filename (AsContext *ctx);

#### Parameters

ctx | a AsContext instance. |

#### Returns

The name of the file the data originates from.

### as_context_set_filename ()

    void
    as_context_set_filename (AsContext *ctx,
                             const gchar *fname);

Sets the file name we are loading data from.

#### Parameters

ctx | a AsContext instance. |
fname | the new file name. |

## Types and Values

### AS_TYPE_CONTEXT

    #define AS_TYPE_CONTEXT (as_context_get_type ())

### struct AsContextClass

    struct AsContextClass {
    	GObjectClass parent_class;
    };

### enum AsFormatVersion

Format version / API level of the AppStream metadata.

#### Members

AS_FORMAT_VERSION_V0_6 | 0.6 |
AS_FORMAT_VERSION_V0_7 | 0.7 |
AS_FORMAT_VERSION_V0_8 | 0.8 |
AS_FORMAT_VERSION_V0_9 | 0.9 |
AS_FORMAT_VERSION_V0_10 | 0.10 |
AS_FORMAT_VERSION_V0_11 | 0.11 |
AS_FORMAT_VERSION_V0_12 | 0.12 |
AS_FORMAT_VERSION_V0_13 | 0.13 |
AS_FORMAT_VERSION_V0_14 | 0.14 |
AS_FORMAT_VERSION_V0_15 | 0.15 |
AS_FORMAT_VERSION_V0_16 | 0.16 |
AS_FORMAT_VERSION_UNKNOWN | Unknown |

### AS_FORMAT_VERSION_CURRENT

    #define AS_FORMAT_VERSION_CURRENT AS_FORMAT_VERSION_V0_16

### AsContext

    typedef struct _AsContext AsContext;