AsRelation: AppStream Library Reference Manual

## AsRelation AsRelation — Description of relations a software component has with other items |

## Functions

const gchar * | as_relation_kind_to_string ()
AsRelationKind | as_relation_kind_from_string ()
const gchar * | as_relation_item_kind_to_string ()
AsRelationItemKind | as_relation_item_kind_from_string ()
AsRelationCompare | as_relation_compare_from_string ()
const gchar * | as_relation_compare_to_string ()
const gchar * | as_relation_compare_to_symbols_string ()
AsRelation * | as_relation_new ()
AsRelationKind | as_relation_get_kind ()
void | as_relation_set_kind ()
AsRelationItemKind | as_relation_get_item_kind ()
void | as_relation_set_item_kind ()
AsRelationCompare | as_relation_get_compare ()
void | as_relation_set_compare ()
const gchar * | as_relation_get_version ()
void | as_relation_set_version ()
const gchar * | as_relation_get_value ()
gint | as_relation_get_value_int ()
void | as_relation_set_value ()
gboolean | as_relation_version_compare ()

## Types and Values

#define | AS_TYPE_RELATION
struct | AsRelationClass
enum | AsRelationKind
enum | AsRelationItemKind
enum | AsRelationCompare
| AsRelation

## Includes

    #include <appstream.h>

## Description

A component can have recommends- or requires relations on other components, system properties, other hardware and interfaces. This class contains a representation of those relations.

See also: AsComponent

## Functions

### as_relation_kind_to_string ()

    const gchar *
    as_relation_kind_to_string (AsRelationKind kind);

Converts the enumerated value to a text representation.

#### Parameters

kind | the AsRelationKind. |

#### Returns

string version of `kind`

Since: 0.12.0

### as_relation_kind_from_string ()

    AsRelationKind
    as_relation_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsRelationKind or `AS_RELATION_KIND_UNKNOWN` for unknown

Since: 0.12.0

### as_relation_item_kind_to_string ()

    const gchar *
    as_relation_item_kind_to_string (AsRelationItemKind kind);

Converts the enumerated value to a text representation.

#### Parameters

kind | the AsRelationKind. |

#### Returns

string version of `kind`

Since: 0.12.0

### as_relation_item_kind_from_string ()

    AsRelationItemKind
    as_relation_item_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsRelationItemKind or `AS_RELATION_ITEM_KIND_UNKNOWN` for unknown

Since: 0.12.0

### as_relation_compare_from_string ()

    AsRelationCompare
    as_relation_compare_from_string (const gchar *compare_str);

Converts the text representation to an enumerated value.

#### Parameters

compare_str | the string. |

#### Returns

a AsRelationCompare, or `AS_RELATION_COMPARE_UNKNOWN` for unknown.

Since: 0.12.0

### as_relation_compare_to_string ()

    const gchar *
    as_relation_compare_to_string (AsRelationCompare compare);

Converts the enumerated value to an text representation. The enum is converted into a two-letter identifier ("eq", "ge", etc.) for use in the XML representation.

#### Parameters

compare | the AsRelationCompare. |

#### Returns

string version of `compare`

Since: 0.12.0

### as_relation_compare_to_symbols_string ()

    const gchar *
    as_relation_compare_to_symbols_string (AsRelationCompare compare);

Converts the enumerated value to an text representation. The enum is converted into an identifier consisting of two mathematical comparison operators ("==", ">=", etc.) for use in the YAML representation and user interfaces.

#### Parameters

compare | the AsRelationCompare. |

#### Returns

string version of `compare`

Since: 0.12.0

### as_relation_new ()

    AsRelation *
    as_relation_new (void);

Creates a new AsRelation.

#### Returns

a AsRelation.

[transfer full]

Since: 0.11.0

### as_relation_get_kind ()

    AsRelationKind
    as_relation_get_kind (AsRelation *relation);

The type (and thereby strength) of this AsRelation.

#### Parameters

relation | a AsRelation instance. |

#### Returns

an enum of type AsRelationKind

Since: 0.12.0

### as_relation_set_kind ()

    void
    as_relation_set_kind (AsRelation *relation,
                          AsRelationKind kind);

Set the kind of this AsRelation.

#### Parameters

relation | a AsRelation instance. |
kind | the new AsRelationKind |

Since: 0.12.0

### as_relation_get_item_kind ()

    AsRelationItemKind
    as_relation_get_item_kind (AsRelation *relation);

The kind of the item of this AsRelation.

#### Parameters

relation | a AsRelation instance. |

#### Returns

an enum of type AsRelationItemKind

Since: 0.12.0

### as_relation_set_item_kind ()

    void
    as_relation_set_item_kind (AsRelation *relation,
                               AsRelationItemKind kind);

Set the kind of the item this AsRelation is about.

#### Parameters

relation | a AsRelation instance. |
kind | the new AsRelationItemKind |

Since: 0.12.0

### as_relation_get_compare ()

    AsRelationCompare
    as_relation_get_compare (AsRelation *relation);

The version comparison type.

#### Parameters

relation | a AsRelation instance. |

#### Returns

an enum of type AsRelationCompare

Since: 0.12.0

### as_relation_set_compare ()

    void
    as_relation_set_compare (AsRelation *relation,
                             AsRelationCompare compare);

Set the version comparison type of this AsRelation.

#### Parameters

relation | an AsRelation instance. |
compare | the new AsRelationCompare |

Since: 0.12.0

### as_relation_get_version ()

    const gchar *
    as_relation_get_version (AsRelation *relation);

#### Parameters

relation | an AsRelation instance. |

#### Returns

The version of the item this AsRelation is about.

Since: 0.12.0

### as_relation_set_version ()

    void
    as_relation_set_version (AsRelation *relation,
                             const gchar *version);

Sets the item version.

#### Parameters

relation | an AsRelation instance. |
version | the new version. |

Since: 0.12.0

### as_relation_get_value ()

    const gchar *
    as_relation_get_value (AsRelation *relation);

#### Parameters

relation | an AsRelation instance. |

#### Returns

The value of the item this AsRelation is about.

Since: 0.12.0

### as_relation_get_value_int ()

    gint
    as_relation_get_value_int (AsRelation *relation);

#### Parameters

relation | an AsRelation instance. |

#### Returns

The value of the item this AsRelation is about as integer.

Since: 0.12.0

### as_relation_set_value ()

    void
    as_relation_set_value (AsRelation *relation,
                           const gchar *value);

Sets the item value.

#### Parameters

relation | an AsRelation instance. |
value | the new value. |

Since: 0.12.0

### as_relation_version_compare ()

    gboolean
    as_relation_version_compare (AsRelation *relation,
                                 const gchar *version,
                                 GError **error);

Tests whether the version number of this AsRelation is fulfilled by `version` . Whether the given version is sufficient to fulfill the version requirement of this AsRelation is determined by its comparison resraint.

#### Parameters

relation | an AsRelation instance. |
version | a version number, e.g. `1.2.0` |
error | A GError or `NULL` |

#### Returns

`TRUE` if the version from the parameter is sufficient.

Since: 0.12.0

## Types and Values

### AS_TYPE_RELATION

    #define AS_TYPE_RELATION (as_relation_get_type ())

### struct AsRelationClass

    struct AsRelationClass {
    	GObjectClass		parent_class;
    };

### enum AsRelationKind

Type of a component's relation to other items.

#### Members

AS_RELATION_KIND_UNKNOWN | Unknown kind |
AS_RELATION_KIND_REQUIRES | The referenced item is required by the component |
AS_RELATION_KIND_RECOMMENDS | The referenced item is recommended |

### enum AsRelationItemKind

Type of the item an AsRelation is for.

#### Members

AS_RELATION_ITEM_KIND_UNKNOWN | Unknown kind |
AS_RELATION_ITEM_KIND_ID | A component ID |
AS_RELATION_ITEM_KIND_MODALIAS | A hardware modalias |
AS_RELATION_ITEM_KIND_KERNEL | An operating system kernel (like Linux) |
AS_RELATION_ITEM_KIND_MEMORY | A system RAM requirement |
AS_RELATION_ITEM_KIND_FIRMWARE | A device firmware requirement (used by fwupd) |

### enum AsRelationCompare

The relational comparison type.

#### Members

AS_RELATION_COMPARE_UNKNOWN | Comparison predicate invalid or not known |
AS_RELATION_COMPARE_EQ | Equal to |
AS_RELATION_COMPARE_NE | Not equal to |
AS_RELATION_COMPARE_LT | Less than |
AS_RELATION_COMPARE_GT | Greater than |
AS_RELATION_COMPARE_LE | Less than or equal to |
AS_RELATION_COMPARE_GE | Greater than or equal to |

### AsRelation

    typedef struct _AsRelation AsRelation;