## AsRequire AsRequire — Object representing a single requirement. |

## Stability Level

Unstable, unless otherwise indicated

## Functions

AsRequire * | as_require_new ()
AsRequireKind | as_require_kind_from_string ()
const gchar * | as_require_kind_to_string ()
AsRequireCompare | as_require_compare_from_string ()
const gchar * | as_require_compare_to_string ()
AsRequireKind | as_require_get_kind ()
AsRequireCompare | as_require_get_compare ()
const gchar * | as_require_get_version ()
const gchar * | as_require_get_value ()
void | as_require_set_kind ()
void | as_require_set_compare ()
void | as_require_set_version ()
void | as_require_set_value ()
gboolean | as_require_version_compare ()
gboolean | as_require_equal ()

## Types and Values

#define | AS_TYPE_REQUIRE
struct | AsRequireClass
enum | AsRequireKind
enum | AsRequireCompare
| AsRequire

## Includes

    #include <appstream-glib.h>

## Description

Requirements are things the component needs to be valid.

See also: AsApp

## Functions

### as_require_new ()

    AsRequire *
    as_require_new (void);

Creates a new AsRequire.

#### Returns

a AsRequire.

[transfer full]

Since: 0.6.7

### as_require_kind_from_string ()

    AsRequireKind
    as_require_kind_from_string (const gchar *kind);

Converts the text representation to an enumerated value.

#### Parameters

kind | the string. |

#### Returns

a AsRequireKind, or `AS_REQUIRE_KIND_UNKNOWN` for unknown.

[transfer full]

Since: 0.6.7

### as_require_kind_to_string ()

    const gchar *
    as_require_kind_to_string (AsRequireKind kind);

Converts the enumerated value to an text representation.

#### Parameters

kind | the AsRequireKind. |

#### Returns

string version of `kind`

Since: 0.6.7

### as_require_compare_from_string ()

    AsRequireCompare
    as_require_compare_from_string (const gchar *compare);

Converts the text representation to an enumerated value.

#### Parameters

compare | the string. |

#### Returns

a AsRequireCompare, or `AS_REQUIRE_COMPARE_UNKNOWN` for unknown.

[transfer full]

Since: 0.6.7

### as_require_compare_to_string ()

    const gchar *
    as_require_compare_to_string (AsRequireCompare compare);

Converts the enumerated value to an text representation.

#### Parameters

compare | the AsRequireCompare. |

#### Returns

string version of `compare`

Since: 0.6.7

### as_require_get_kind ()

    AsRequireKind
    as_require_get_kind (AsRequire *require);

Gets the require kind.

#### Parameters

require | a AsRequire instance. |

#### Returns

the AsRequireKind

Since: 0.6.7

### as_require_get_compare ()

    AsRequireCompare
    as_require_get_compare (AsRequire *require);

Gets the require version comparison type.

#### Parameters

require | a AsRequire instance. |

#### Returns

the AsRequireKind

Since: 0.6.7

### as_require_get_version ()

    const gchar *
    as_require_get_version (AsRequire *require);

Gets the require version if set.

#### Parameters

require | a AsRequire instance. |

#### Returns

the version, e.g. "0.1.2"

Since: 0.6.7

### as_require_get_value ()

    const gchar *
    as_require_get_value (AsRequire *require);

Gets the require value if set.

#### Parameters

require | a AsRequire instance. |

#### Returns

the value, e.g. "bootloader"

Since: 0.6.7

### as_require_set_kind ()

    void
    as_require_set_kind (AsRequire *require,
                         AsRequireKind kind);

Sets the require kind.

#### Parameters

require | a AsRequire instance. |
kind | the AsRequireKind, e.g. `AS_REQUIRE_KIND_ID`. |

Since: 0.6.7

### as_require_set_compare ()

    void
    as_require_set_compare (AsRequire *require,
                            AsRequireCompare compare);

Sets the require version comparison type.

#### Parameters

require | a AsRequire instance. |
compare | the AsRequireKind, e.g. `AS_REQUIRE_KIND_ID`. |

Since: 0.6.7

### as_require_set_version ()

    void
    as_require_set_version (AsRequire *require,
                            const gchar *version);

Sets the require version.

#### Parameters

require | a AsRequire instance. |
version | an version number, e.g. `0.1.2` |

Since: 0.6.7

### as_require_set_value ()

    void
    as_require_set_value (AsRequire *require,
                          const gchar *value);

Sets the require value.

#### Parameters

require | a AsRequire instance. |
value | an require version, e.g. `firmware` |

Since: 0.6.7

### as_require_version_compare ()

    gboolean
    as_require_version_compare (AsRequire *require,
                                const gchar *version,
                                GError **error);

Compares the version number of the requirement with a predicate.

#### Parameters

require | a AsRequire instance. |
version | a version number, e.g. `0.1.3` |
error | A GError or `NULL` |

#### Returns

`TRUE` if the predicate was true

Since: 0.6.7

### as_require_equal ()

    gboolean
    as_require_equal (AsRequire *require1,
                      AsRequire *require2);

Checks if two requires are the same.

#### Parameters

require1 | a AsRequire instance. |
require2 | a AsRequire instance. |

#### Returns

`TRUE` for success

Since: 0.7.7

## Types and Values

### AS_TYPE_REQUIRE

    #define AS_TYPE_REQUIRE (as_require_get_type ())

### struct AsRequireClass

    struct AsRequireClass {
    	GObjectClass		parent_class;
    };

### enum AsRequireKind

The require type.

#### Members

AS_REQUIRE_KIND_UNKNOWN | Type invalid or not known |
AS_REQUIRE_KIND_ID | Component ID |
AS_REQUIRE_KIND_FIRMWARE | Device firmware version |
AS_REQUIRE_KIND_HARDWARE | Hardware device, typically a GUID |
AS_REQUIRE_KIND_MODALIAS | Modalias string |
AS_REQUIRE_KIND_KERNEL | Kernel version |
AS_REQUIRE_KIND_MEMORY | Amount of installed memory in MiB |

### enum AsRequireCompare

The relational comparison type.

#### Members

AS_REQUIRE_COMPARE_UNKNOWN | Comparison predicate invalid or not known |
AS_REQUIRE_COMPARE_EQ | Equal to |
AS_REQUIRE_COMPARE_NE | Not equal to |
AS_REQUIRE_COMPARE_LT | Less than |
AS_REQUIRE_COMPARE_GT | Greater than |
AS_REQUIRE_COMPARE_LE | Less than or equal to |
AS_REQUIRE_COMPARE_GE | Greater than or equal to |
AS_REQUIRE_COMPARE_GLOB | Filename glob, e.g. `test*` |
AS_REQUIRE_COMPARE_REGEX | A regular expression, e.g. `fw[0-255]` |

### AsRequire

    typedef struct _AsRequire AsRequire;