## PackageIDs PackageIDs — Functions for process PackageIDs |

## Functions

gchar * | pk_package_id_build ()
gboolean | pk_package_id_check ()
gchar ** | pk_package_id_split ()
gchar * | pk_package_id_to_printable ()
gboolean | pk_package_id_equal_fuzzy_arch ()
gchar ** | pk_package_ids_from_id ()
gchar ** | pk_package_ids_from_string ()
gboolean | pk_package_ids_check ()
gchar * | pk_package_ids_to_string ()
gboolean | pk_package_ids_present_id ()
gchar ** | pk_package_ids_add_id ()
gchar ** | pk_package_ids_add_ids ()
gchar ** | pk_package_ids_remove_id ()

## Types and Values

#define | PK_PACKAGE_ID_NAME
#define | PK_PACKAGE_ID_VERSION
#define | PK_PACKAGE_ID_ARCH
#define | PK_PACKAGE_ID_DATA
#define | PK_PACKAGE_IDS_DELIM
#define | pk_package_ids_from_text
#define | pk_package_ids_to_text

## Description

## Functions

### pk_package_id_build ()

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

Generate a PackageID.

#### Parameters

name | the package name |
version | the package version |
arch | the package architecture |
data | the package extra data |

#### Returns

returns a string to form the PackageID.

Since: 0.5.0

### pk_package_id_check ()

    gboolean
    pk_package_id_check (const gchar *package_id);

Check if a Packageid is well formed.

#### Parameters

package_id | the PackageID to check |

#### Returns

`TRUE` if the PackageID was well formed.

Since: 0.5.0

### pk_package_id_split ()

    gchar **
    pk_package_id_split (const gchar *package_id);

Splits a PackageID into the correct number of parts, checking the correct number of delimiters are present.

#### Parameters

package_id | the ; delimited PackageID to split |

#### Returns

a GStrv or `NULL` if invalid, use `g_strfreev()` to free.

[transfer full]

Since: 0.5.3

### pk_package_id_to_printable ()

    gchar *
    pk_package_id_to_printable (const gchar *package_id);

Formats the PackageID to be printable to the user.

#### Parameters

package_id | the PackageID |

#### Returns

the name-version.arch formatted string, use `g_free()` to free.

Since: 0.5.2

### pk_package_id_equal_fuzzy_arch ()

    gboolean
    pk_package_id_equal_fuzzy_arch (const gchar *package_id1,
                                    const gchar *package_id2);

Only compare the name, version, and arch, where the architecture will fuzzy match with i*86.

#### Parameters

package_id1 | the first PackageID |
package_id2 | the second PackageID |

#### Returns

`TRUE` if the PackageIDs can be considered equal.

Since: 0.5.0

### pk_package_ids_from_id ()

    gchar **
    pk_package_ids_from_id (const gchar *package_id);

Form a composite string array of package_id's from a single package_id

#### Parameters

package_id | A single package_id |

#### Returns

the string array, or `NULL` if invalid, free with `g_strfreev()`.

[transfer full]

Since: 0.5.2

### pk_package_ids_from_string ()

    gchar **
    pk_package_ids_from_string (const gchar *package_id);

Form a composite string array of package_id's from a delimited string

#### Parameters

package_id | A single package_id |

#### Returns

the string array, or `NULL` if invalid, free with `g_strfreev()`.

[transfer full]

Since: 0.5.2

### pk_package_ids_check ()

    gboolean
    pk_package_ids_check (gchar **package_ids);

Check the string array of package_id's for validity

#### Parameters

package_ids | a string array of package_id's |

#### Returns

`TRUE` if the package_ids are all valid.

Since: 0.5.2

### pk_package_ids_to_string ()

    gchar *
    pk_package_ids_to_string (gchar **package_ids);

Cats the string array of package_id's into one delimited string

#### Parameters

package_ids | a string array of package_id's |

#### Returns

a string representation of all the package_id's.

Since: 0.5.2

### pk_package_ids_present_id ()

    gboolean
    pk_package_ids_present_id (gchar **package_ids,
                               const gchar *package_id);

Finds out if a package ID is present in the list.

#### Parameters

package_ids | a string array of package_id's |
package_id | a single package_id |

#### Returns

`TRUE` if the package ID is present

Since: 0.5.2

### pk_package_ids_add_id ()

    gchar **
    pk_package_ids_add_id (gchar **package_ids,
                           const gchar *package_id);

Adds a package_id to an existing list.

#### Parameters

package_ids | a string array of package_id's |
package_id | a single package_id |

#### Returns

the new list, free `g_strfreev()`.

[transfer full]

Since: 0.5.2

### pk_package_ids_add_ids ()

    gchar **
    pk_package_ids_add_ids (gchar **package_ids,
                            gchar **package_ids_new);

Adds a package_id to an existing list.

#### Parameters

package_ids | a string array of package_id's |
package_ids_new | a string array of package_id's |

#### Returns

the new list, free `g_strfreev()`.

[transfer full]

Since: 0.5.2

### pk_package_ids_remove_id ()

    gchar **
    pk_package_ids_remove_id (gchar **package_ids,
                              const gchar *package_id);

Removes a package ID from the the list.

#### Parameters

package_ids | a string array of package_id's |
package_id | a single package_id |

#### Returns

the new list, free `g_strfreev()`.

[transfer full]

Since: 0.5.2

## Types and Values

### PK_PACKAGE_ID_NAME

    #define PK_PACKAGE_ID_NAME 0

Alias to get a name field from the result of pk_package_id_split

### PK_PACKAGE_ID_VERSION

    #define PK_PACKAGE_ID_VERSION 1

Alias to get a version field from the result of pk_package_id_split

### PK_PACKAGE_ID_ARCH

    #define PK_PACKAGE_ID_ARCH 2

Alias to get an arch field from the result of pk_package_id_split

### PK_PACKAGE_ID_DATA

    #define PK_PACKAGE_ID_DATA 3

Alias to get a data field from the result of pk_package_id_split

### PK_PACKAGE_IDS_DELIM

    #define PK_PACKAGE_IDS_DELIM "&"

### pk_package_ids_from_text

    #define pk_package_ids_from_text pk_package_ids_from_string

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

Use `pk_package_ids_from_string()`

Form a composite string array of package_id's from a delimited string

#### Parameters

package_id | A single package_id |

#### Returns

the string array, or `NULL` if invalid, free with `g_strfreev()`.

[transfer full]

### pk_package_ids_to_text

    #define pk_package_ids_to_text		pk_package_ids_to_string

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

pk_package_ids_to_string()

Cats the string array of package_id's into one delimited string

#### Parameters

package_ids | a string array of package_id's |

#### Returns

a string representation of all the package_id's.