ZifDepend

## ZifDepend ZifDepend — A package dependency |

## Synopsis

    #define             ZIF_DEPEND_ERROR
    struct              ZifDepend;
    struct              ZifDependClass;
    enum                ZifDependFlag;
    gint                zif_depend_compare                  (ZifDepend *a,
                                                             ZifDepend *b);
    const gchar *       zif_depend_flag_to_string           (ZifDependFlag flag);
    const gchar *       zif_depend_get_description          (ZifDepend *depend);
    ZifDependFlag       zif_depend_get_flag                 (ZifDepend *depend);
    const gchar *       zif_depend_get_name                 (ZifDepend *depend);
    const gchar *       zif_depend_get_version              (ZifDepend *depend);
    ZifDepend *         zif_depend_new                      (void);
    ZifDepend *         zif_depend_new_from_values          (const gchar *name,
                                                             ZifDependFlag flag,
                                                             const gchar *version);
    gboolean            zif_depend_parse_description        (ZifDepend *depend,
                                                             const gchar *value,
                                                             GError **error);
    gboolean            zif_depend_satisfies                (ZifDepend *got,
                                                             ZifDepend *need);
    gchar *             zif_depend_to_string                (ZifDepend *depend);

## Object Hierarchy

      GObject
       +----ZifDepend

## Properties

      "flag"                     guint                 : Read / Write
      "name"                     gchar*                : Read / Write
      "version"                  gchar*                : Read / Write

## Description

An object to represent some information about an encoded dependency.

## Details

### ZIF_DEPEND_ERROR

    #define ZIF_DEPEND_ERROR (zif_depend_error_quark ())

### struct ZifDepend

    struct ZifDepend;

### struct ZifDependClass

    struct ZifDependClass {
    	GObjectClass		 parent_class;
    	/* Padding for future expansion */
    	void (*_zif_reserved1) (void);
    	void (*_zif_reserved2) (void);
    	void (*_zif_reserved3) (void);
    	void (*_zif_reserved4) (void);
    };

### enum ZifDependFlag

    typedef enum {
    	ZIF_DEPEND_FLAG_ANY = 1,
    	ZIF_DEPEND_FLAG_LESS = 2,
    	ZIF_DEPEND_FLAG_GREATER = 4,
    	ZIF_DEPEND_FLAG_EQUAL = 8,
    	ZIF_DEPEND_FLAG_UNKNOWN = 0
    } ZifDependFlag;

`ZIF_DEPEND_FLAG_ANY` |
`ZIF_DEPEND_FLAG_LESS` |
`ZIF_DEPEND_FLAG_GREATER` |
`ZIF_DEPEND_FLAG_EQUAL` |
`ZIF_DEPEND_FLAG_UNKNOWN` |

### zif_depend_compare ()

    gint                zif_depend_compare                  (ZifDepend *a,
                                                             ZifDepend *b);

Compares one dependancy against another. This is basically a `zif_compare_evr()` on the versions.

`a` : | A ZifDepend
`b` : | A ZifDepend to compare
Returns : | 1 for a>b, 0 for a==b, -1 for b>a, or G_MAXINT for error

Since 0.1.3

### zif_depend_flag_to_string ()

    const gchar *       zif_depend_flag_to_string           (ZifDependFlag flag);

Returns a string representation of the ZifDependFlag.

`flag` : | A ZifDependFlag
Returns : | string value

Since 0.1.0

### zif_depend_get_description ()

    const gchar *       zif_depend_get_description          (ZifDepend *depend);

Returns a string representation of the ZifDepend object.

`depend` : | A ZifDepend
Returns : | string value

Since 0.1.3

### zif_depend_get_flag ()

    ZifDependFlag       zif_depend_get_flag                 (ZifDepend *depend);

Gets the depend flag.

`depend` : | A ZifDepend
Returns : | A flag of depend, e.g. `ZIF_DEPEND_FLAG_LESS`.

Since 0.1.3

### zif_depend_get_name ()

    const gchar *       zif_depend_get_name                 (ZifDepend *depend);

Gets the name for this depend.

`depend` : | A ZifDepend
Returns : | A string value, or `NULL`.

Since 0.1.3

### zif_depend_get_version ()

    const gchar *       zif_depend_get_version              (ZifDepend *depend);

Gets the version for this depend.

`depend` : | A ZifDepend
Returns : | A string value, or `NULL`.

Since 0.1.3

### zif_depend_new ()

    ZifDepend *         zif_depend_new                      (void);

Returns : | A new ZifDepend instance.

Since 0.1.3

### zif_depend_new_from_values ()

    ZifDepend *         zif_depend_new_from_values          (const gchar *name,
                                                             ZifDependFlag flag,
                                                             const gchar *version);

`name` : | The depend name
`flag` : | The depend flag
`version` : | The depend version
Returns : | A new ZifDepend instance, or `NULL` for error

Since 0.2.4

### zif_depend_parse_description ()

    gboolean            zif_depend_parse_description        (ZifDepend *depend,
                                                             const gchar *value,
                                                             GError **error);

Parses a depend string and sets internal state.

`depend` : | A ZifDepend
`value` : | Depend string, e.g. "obsolete-package < 1.0.0"
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 0.1.3

### zif_depend_satisfies ()

    gboolean            zif_depend_satisfies                (ZifDepend *got,
                                                             ZifDepend *need);

Returns if the dependency will be satisfied with what we've got.

`got` : | The ZifDepend we've got
`need` : | The ZifDepend we need
Returns : | `TRUE` if okay, `FALSE` otherwise

Since 0.1.3

### zif_depend_to_string ()

    gchar *             zif_depend_to_string                (ZifDepend *depend);

Returns a string representation of the ZifDepend object.

Note: this function is deprecated, use `zif_depend_get_description()` instead as it is more efficient.

`depend` : | A ZifDepend
Returns : | string value

Since 0.1.0

## Property Details

### The `"flag"` property

      "flag"                     guint                 : Read / Write

Default value: 0

Since 0.1.3

### The `"name"` property

      "name"                     gchar*                : Read / Write

Default value: NULL

Since 0.1.3

### The `"version"` property

      "version"                  gchar*                : Read / Write

Default value: NULL

Since 0.1.3