zif-package-array

## zif-package-array zif-package-array — Arrays of packages |

## Synopsis

    gboolean            zif_package_array_download          (GPtrArray *packages,
                                                             const gchar *directory,
                                                             ZifState *state,
                                                             GError **error);
    void                zif_package_array_filter_arch       (GPtrArray *array,
                                                             const gchar *arch);
    void                zif_package_array_filter_best_arch  (GPtrArray *array,
                                                             const gchar *arch);
    void                zif_package_array_filter_duplicates (GPtrArray *packages);
    gboolean            zif_package_array_filter_newest     (GPtrArray *packages);
    ZifPackage *        zif_package_array_find              (GPtrArray *array,
                                                             const gchar *package_id,
                                                             GError **error);
    ZifPackage *        zif_package_array_get_newest        (GPtrArray *array,
                                                             GError **error);
    ZifPackage *        zif_package_array_get_oldest        (GPtrArray *array,
                                                             GError **error);
    GPtrArray *         zif_package_array_new               (void);

## Description

## Details

### zif_package_array_download ()

    gboolean            zif_package_array_download          (GPtrArray *packages,
                                                             const gchar *directory,
                                                             ZifState *state,
                                                             GError **error);

Downloads a list of packages.

`packages` : | array of `ZifPackage`'s
`directory` : | A local directory to save to, or `NULL` to use the package cache
`state` : | A ZifState to use for progress reporting
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success, `FALSE` otherwise

Since 0.2.5

### zif_package_array_filter_arch ()

    void                zif_package_array_filter_arch       (GPtrArray *array,
                                                             const gchar *arch);

Filters the array so that only the matching arch of a package remains.

`array` : | Array of `ZifPackage`'s. [element-type ZifPackage]
`arch` : | architecture string, e.g. "i486"

Since 0.1.3

### zif_package_array_filter_best_arch ()

    void                zif_package_array_filter_best_arch  (GPtrArray *array,
                                                             const gchar *arch);

Filters the array so that only the best version of a package remains.

If we have the following packages: - glibc.i386 - hal.i386 - glibc.i686

Then we output: - glibc.i686

`array` : | Array of `ZifPackage`'s. [element-type ZifPackage]

Since 0.2.1

### zif_package_array_filter_duplicates ()

    void                zif_package_array_filter_duplicates (GPtrArray *packages);

Filters the list for duplicates.

`packages` : | array of `ZifPackage`'s

Since 0.2.1

### zif_package_array_filter_newest ()

    gboolean            zif_package_array_filter_newest     (GPtrArray *packages);

Filters the list so that only the newest version of a package remains.

`packages` : | array of `ZifPackage`'s
Returns : | `TRUE` if the array was modified

Since 0.1.0

### zif_package_array_find ()

    ZifPackage *        zif_package_array_find              (GPtrArray *array,
                                                             const gchar *package_id,
                                                             GError **error);

Finds a package from an array.

`array` : | Array of `ZifPackage`'s. [element-type ZifPackage]
`package_id` : | A GError, or `NULL`
`error` : | A GError, or `NULL`
Returns : | A single `ZifPackage`, or `NULL` in the case of an error. The returned object should be freed with `g_object_unref()` when no longer needed. [transfer full]

Since 0.2.1

### zif_package_array_get_newest ()

    ZifPackage *        zif_package_array_get_newest        (GPtrArray *array,
                                                             GError **error);

Returns the newest package from a list. The package name is not used when calculating the newest package.

`array` : | Array of `ZifPackage`'s. [element-type ZifPackage]
`error` : | A GError, or `NULL`
Returns : | A single `ZifPackage`, or `NULL` in the case of an error. The returned object should be freed with `g_object_unref()` when no longer needed. [transfer full]

Since 0.1.0

### zif_package_array_get_oldest ()

    ZifPackage *        zif_package_array_get_oldest        (GPtrArray *array,
                                                             GError **error);

Returns the oldest package from a list.

`array` : | Array of `ZifPackage`'s. [element-type ZifPackage]
`error` : | A GError, or `NULL`
Returns : | A single `ZifPackage`, or `NULL` in the case of an error. The returned object should be freed with `g_object_unref()` when no longer needed. [transfer full]

Since 0.1.3

### zif_package_array_new ()

    GPtrArray *         zif_package_array_new               (void);

Returns : | A new GPtrArray instance. [element-type ZifPackage][transfer container]

Since 0.1.3