## pk-package-id

pk-package-id — Functionality to modify a PackageID

## Synopsis

                        PkPackageId;
    PkPackageId *       pk_package_id_new                   (void);
    PkPackageId *       pk_package_id_new_from_string       (const gchar *package_id);
    PkPackageId *       pk_package_id_new_from_list         (const gchar *name,
                                                             const gchar *version,
                                                             const gchar *arch,
                                                             const gchar *data);
    PkPackageId *       pk_package_id_copy                  (const PkPackageId *id);
    gboolean            pk_package_id_equal                 (const PkPackageId *id1,
                                                             const PkPackageId *id2);
    gboolean            pk_package_id_equal_fuzzy_arch      (const PkPackageId *id1,
                                                             const PkPackageId *id2);
    gchar *             pk_package_id_to_string             (const PkPackageId *id);
    gboolean            pk_package_id_free                  (PkPackageId *id);
    gchar *             pk_package_id_build                 (const gchar *name,
                                                             const gchar *version,
                                                             const gchar *arch,
                                                             const gchar *data);
    gboolean            pk_package_id_check                 (const gchar *package_id);
    gboolean            pk_package_id_equal_strings         (const gchar *pid1,
                                                             const gchar *pid2);

## Description

PackageId's are difficult to read and create.

## Details

### PkPackageId

    typedef struct {
    	gchar	*name;
    	gchar	*version;
    	gchar	*arch;
    	gchar	*data;
    } PkPackageId;

Cached object to represent a package ID.

### pk_package_id_new ()

    PkPackageId *       pk_package_id_new                   (void);

Creates a new PkPackageId object with default values

Returns : | a new PkPackageId object

### pk_package_id_new_from_string ()

    PkPackageId *       pk_package_id_new_from_string       (const gchar *package_id);

Creates a new PkPackageId object with values taken from the supplied id.

`package_id` : | the text to pre-fill the object
Returns : | a new PkPackageId object

### pk_package_id_new_from_list ()

    PkPackageId *       pk_package_id_new_from_list         (const gchar *name,
                                                             const gchar *version,
                                                             const gchar *arch,
                                                             const gchar *data);

Creates a new PkPackageId object with values.

`name` : | the package name
`version` : | the package version
`arch` : | the package architecture
`data` : | the package extra data
Returns : | a new PkPackageId object

### pk_package_id_copy ()

    PkPackageId *       pk_package_id_copy                  (const PkPackageId *id);

Copies into a new PkPackageId object.

`id` : | the `PkPackageId` structure to copy
Returns : | a new PkPackageId object

### pk_package_id_equal ()

    gboolean            pk_package_id_equal                 (const PkPackageId *id1,
                                                             const PkPackageId *id2);

Only compare the name, version, and arch

`id1` : | the first `PkPackageId`
`id2` : | the second `PkPackageId`
Returns : | `TRUE` if the ids can be considered equal.

### pk_package_id_equal_fuzzy_arch ()

    gboolean            pk_package_id_equal_fuzzy_arch      (const PkPackageId *id1,
                                                             const PkPackageId *id2);

Only compare the name, version, and arch

`id1` : | the first `PkPackageId`
`id2` : | the second `PkPackageId`
Returns : | `TRUE` if the ids can be considered equal.

### pk_package_id_to_string ()

    gchar *             pk_package_id_to_string             (const PkPackageId *id);

`id` : | A PkPackageId object
Returns : | returns a string representation of PkPackageId.

### pk_package_id_free ()

    gboolean            pk_package_id_free                  (PkPackageId *id);

`id` : | the PkPackageId object
Returns : | `TRUE` if the PkPackageId object was freed.

### pk_package_id_build ()

    gchar *             pk_package_id_build                 (const gchar *name,
                                                             const gchar *version,
                                                             const gchar *arch,
                                                             const gchar *data);

`name` : | the package name
`version` : | the package version
`arch` : | the package architecture
`data` : | the package extra data
Returns : | returns a string putting together the data.

### pk_package_id_check ()

    gboolean            pk_package_id_check                 (const gchar *package_id);

`package_id` : | the text the check
Returns : | `TRUE` if the package_id was well formed.

### pk_package_id_equal_strings ()

    gboolean            pk_package_id_equal_strings         (const gchar *pid1,
                                                             const gchar *pid2);

Only compare the first three sections, data is not part of the match

`pid1` : | the first package_id
`pid2` : | the second package_id
Returns : | `TRUE` if the package_id's can be considered equal.