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

## 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 ()
const gchar * | as_control_kind_to_string ()
AsControlKind | as_control_kind_from_string ()
const gchar * | as_display_side_kind_to_string ()
AsDisplaySideKind | as_display_side_kind_from_string ()
const gchar * | as_display_length_kind_to_string ()
AsDisplayLengthKind | as_display_length_kind_from_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_str ()
void | as_relation_set_value_str ()
gint | as_relation_get_value_int ()
void | as_relation_set_value_int ()
AsControlKind | as_relation_get_value_control_kind ()
void | as_relation_set_value_control_kind ()
AsDisplaySideKind | as_relation_get_display_side_kind ()
void | as_relation_set_display_side_kind ()
gint | as_relation_get_value_px ()
void | as_relation_set_value_px ()
AsDisplayLengthKind | as_relation_get_value_display_length_kind ()
void | as_relation_set_value_display_length_kind ()
gboolean | as_relation_version_compare ()
const gchar * | as_relation_get_value ()
void | as_relation_set_value ()

## Types and Values

#define | AS_TYPE_RELATION
struct | AsRelationClass
enum | AsRelationKind
enum | AsRelationItemKind
enum | AsRelationCompare
enum | AsControlKind
enum | AsDisplaySideKind
enum | AsDisplayLengthKind
| AsRelation

## Includes

    #include <appstream.h>

## Description

A component can have recommends- or requires relations on other components, system properties, hardware and other 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_control_kind_to_string ()

    const gchar *
    as_control_kind_to_string (AsControlKind kind);

Converts the enumerated value to a text representation.

#### Parameters

kind | the AsControlKind. |

#### Returns

string version of `kind`

Since: 0.12.11

### as_control_kind_from_string ()

    AsControlKind
    as_control_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsControlKind or `AS_CONTROL_KIND_UNKNOWN` for unknown

Since: 0.12.11

### as_display_side_kind_to_string ()

    const gchar *
    as_display_side_kind_to_string (AsDisplaySideKind kind);

Converts the enumerated value to a text representation.

#### Parameters

kind | the AsDisplaySideKind. |

#### Returns

string version of `kind`

Since: 0.12.12

### as_display_side_kind_from_string ()

    AsDisplaySideKind
    as_display_side_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsDisplaySideKind or `AS_DISPLAY_SIDE_KIND_UNKNOWN` for unknown

Since: 0.12.12

### as_display_length_kind_to_string ()

    const gchar *
    as_display_length_kind_to_string (AsDisplayLengthKind kind);

Converts the enumerated value to a text representation.

#### Parameters

kind | the AsDisplayLengthKind. |

#### Returns

string version of `kind`

Since: 0.12.12

### as_display_length_kind_from_string ()

    AsDisplayLengthKind
    as_display_length_kind_from_string (const gchar *kind_str);

Converts the text representation to an enumerated value.

#### Parameters

kind_str | the string. |

#### Returns

a AsDisplayLengthKind or `AS_DISPLAY_LENGTH_KIND_UNKNOWN` for unknown

Since: 0.12.12

### 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_str ()

    const gchar *
    as_relation_get_value_str (AsRelation *relation);

#### Parameters

relation | an AsRelation instance. |

#### Returns

The value of the item this AsRelation is about, as a string.

Since: 0.12.12

### as_relation_set_value_str ()

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

Sets the item value as a string, if the given item type of this AsRelation permits string values.

#### Parameters

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

Since: 0.12.12

### as_relation_get_value_int ()

    gint
    as_relation_get_value_int (AsRelation *relation);

#### Parameters

relation | an AsRelation instance. |

#### Returns

The value of this AsRelation item as an integer. Returns 0 if the value was no integer.

Since: 0.12.0

### as_relation_set_value_int ()

    void
    as_relation_set_value_int (AsRelation *relation,
                               gint value);

Sets the item value as an integer, if the given item type of this AsRelation permits integer values.

#### Parameters

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

Since: 0.12.12

### as_relation_get_value_control_kind ()

    AsControlKind
    as_relation_get_value_control_kind (AsRelation *relation);

Get the value of this AsRelation item as AsControlKind if the type of this relation is `AS_RELATION_ITEM_KIND_CONTROL`. Otherwise return `AS_CONTROL_KIND_UNKNOWN`

#### Parameters

relation | an AsRelation instance. |

#### Returns

a AsControlKind or `AS_CONTROL_KIND_UNKNOWN` in case the item is not of the right kind.

Since: 0.12.11

### as_relation_set_value_control_kind ()

    void
    as_relation_set_value_control_kind (AsRelation *relation,
                                        AsControlKind kind);

Set relation item value from an AsControlKind.

#### Parameters

relation | an AsRelation instance. |
kind | an AsControlKind |

Since: 0.12.12

### as_relation_get_display_side_kind ()

    AsDisplaySideKind
    as_relation_get_display_side_kind (AsRelation *relation);

Gets the display side kind, in case this item is of kind `AS_RELATION_ITEM_KIND_DISPLAY_LENGTH`

#### Parameters

relation | an AsRelation instance. |

#### Returns

a AsDisplaySideKind or `AS_DISPLAY_SIDE_KIND_UNKNOWN`

Since: 0.12.12

### as_relation_set_display_side_kind ()

    void
    as_relation_set_display_side_kind (AsRelation *relation,
                                       AsDisplaySideKind kind);

Sets the display side kind, in case this item is of kind `AS_RELATION_ITEM_KIND_DISPLAY_LENGTH`

#### Parameters

relation | an AsRelation instance. |
kind | the new AsDisplaySideKind. |

Since: 0.12.12

### as_relation_get_value_px ()

    gint
    as_relation_get_value_px (AsRelation *relation);

In case this AsRelation is of kind `AS_RELATION_ITEM_KIND_DISPLAY_LENGTH`, return the set logical pixel amount.

#### Parameters

relation | an AsRelation instance. |

#### Returns

The logical pixel amount for this display length, value <= 0 on error.

Since: 0.12.12

### as_relation_set_value_px ()

    void
    as_relation_set_value_px (AsRelation *relation,
                              gint logical_px);

Sets the item value as logical pixel count. This requires the relation to be of item kind `AS_RELATION_ITEM_KIND_DISPLAY_LENGTH`.

#### Parameters

relation | an AsRelation instance. |
logical_px | logical pixel count. |

Since: 0.12.12

### as_relation_get_value_display_length_kind ()

    AsDisplayLengthKind
    as_relation_get_value_display_length_kind
                                   (AsRelation *relation);

In case this AsRelation is of kind `AS_RELATION_ITEM_KIND_DISPLAY_LENGTH`, return the AsDisplayLengthKind.

#### Parameters

relation | an AsRelation instance. |

#### Returns

The AsDisplayLengthKind classification of the current pixel value, or `AS_DISPLAY_LENGTH_KIND_UNKNOWN` on error.

Since: 0.12.12

### as_relation_set_value_display_length_kind ()

    void
    as_relation_set_value_display_length_kind
                                   (AsRelation *relation,
                                    AsDisplayLengthKind kind);

Sets the item value as display length placeholder value. This requires the relation to be of item kind `AS_RELATION_ITEM_KIND_DISPLAY_LENGTH`.

#### Parameters

relation | an AsRelation instance. |
kind | the AsDisplayLengthKind |

Since: 0.12.12

### 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

### as_relation_get_value ()

    const gchar *
    as_relation_get_value (AsRelation *relation);

`as_relation_get_value` is deprecated and should not be used in newly-written code.

Deprecated method. Use `as_relation_get_value_str` instead.

#### Parameters

relation | an AsRelation instance. |

Since: 0.12.0

### as_relation_set_value ()

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

`as_relation_set_value` is deprecated and should not be used in newly-written code.

Deprecated method. Use `as_relation_set_value_str` instead.

#### Parameters

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

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) |
AS_RELATION_ITEM_KIND_CONTROL | An input method for users to control software |
AS_RELATION_ITEM_KIND_DISPLAY_LENGTH | Display edge length |

### 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 |

### enum AsControlKind

Kind of an input method for users to control software

#### Members

AS_CONTROL_KIND_UNKNOWN | Unknown kind |
AS_CONTROL_KIND_POINTING | Mouse/cursors/other pointing device |
AS_CONTROL_KIND_KEYBOARD | Keyboard input |
AS_CONTROL_KIND_CONSOLE | Console / command-line interface |
AS_CONTROL_KIND_TOUCH | Touch input |
AS_CONTROL_KIND_GAMEPAD | Gamepad input (any game controller with wheels/buttons/joysticks) |
AS_CONTROL_KIND_VOICE | Control via voice recognition/activation |
AS_CONTROL_KIND_VISION | Computer vision / visual object and sign detection |
AS_CONTROL_KIND_TV_REMOTE | A television remote |

### enum AsDisplaySideKind

Side a display_length requirement is for.

#### Members

AS_DISPLAY_SIDE_KIND_UNKNOWN | Unknown |
AS_DISPLAY_SIDE_KIND_SHORTEST | Shortest side of the display rectangle. |
AS_DISPLAY_SIDE_KIND_LONGEST | Longest side of the display rectangle. |

### enum AsDisplayLengthKind

A rough estimate of how large a given display length is.

#### Members

AS_DISPLAY_LENGTH_KIND_UNKNOWN | Unknown |
AS_DISPLAY_LENGTH_KIND_XSMALL | Very small display |
AS_DISPLAY_LENGTH_KIND_SMALL | Small display |
AS_DISPLAY_LENGTH_KIND_MEDIUM | Medium display |
AS_DISPLAY_LENGTH_KIND_LARGE | Large display |
AS_DISPLAY_LENGTH_KIND_XLARGE | Very large display |

### AsRelation

    typedef struct _AsRelation AsRelation;