![]() |
![]() |
![]() |
PackageKit Reference Manual | ![]() |
---|---|---|---|---|
PkEnumListPrivate; PkEnumList; enum PkEnumListType; PkEnumList* pk_enum_list_new (void); gboolean pk_enum_list_set_type (PkEnumList *elist, PkEnumListType type); gboolean pk_enum_list_from_string (PkEnumList *elist, const gchar *enums); gchar* pk_enum_list_to_string (PkEnumList *elist); guint pk_enum_list_size (PkEnumList *elist); guint pk_enum_list_get_item (PkEnumList *elist, guint item); gboolean pk_enum_list_contains (PkEnumList *elist, guint value); gint pk_enum_list_contains_priority (PkEnumList *elist, gint value, ...); gboolean pk_enum_list_append (PkEnumList *elist, guint value); gboolean pk_enum_list_remove (PkEnumList *elist, guint value); gboolean pk_enum_list_print (PkEnumList *elist); gboolean pk_enum_list_append_multiple (PkEnumList *elist, gint value, ...);
This file contains functions that can manage lists of enumerated values of different types. These functions will be much quicker than manipulating strings directly.
typedef enum { PK_ENUM_LIST_TYPE_ROLE, PK_ENUM_LIST_TYPE_GROUP, PK_ENUM_LIST_TYPE_FILTER, PK_ENUM_LIST_TYPE_STATUS, PK_ENUM_LIST_TYPE_UNKNOWN } PkEnumListType;
gboolean pk_enum_list_set_type (PkEnumList *elist, PkEnumListType type);
This function sets the type of list. You don't /need/ to use this function, but is required if you print or get the list as we need to know what pk_xxxx_enum_to_text function to use for each part.
|
a valid PkEnumList instance |
|
the type of list this should be |
Returns : |
TRUE if we set the list type
|
gboolean pk_enum_list_from_string (PkEnumList *elist, const gchar *enums);
Set the list with a seed string. Converting the seed string once allows us to deal with raw enumerated integers, which is often much faster.
|
a valid PkEnumList instance |
|
a text representation of the list, e.g. "search-name;search-details" |
Returns : |
TRUE if we appended the data
|
gchar* pk_enum_list_to_string (PkEnumList *elist);
Converts the enumerated list back to a string.
|
a valid PkEnumList instance |
Returns : |
A string representing the enumerated list, e.g. "search-name;search-details" |
guint pk_enum_list_size (PkEnumList *elist);
|
a valid PkEnumList instance |
Returns : |
the size of the enumerated list. |
guint pk_enum_list_get_item (PkEnumList *elist, guint item);
|
a valid PkEnumList instance |
|
the item number of the list |
Returns : |
the enum value for this position, or zero if error. |
gboolean pk_enum_list_contains (PkEnumList *elist, guint value);
Searches the list looking for a specific value.
|
a valid PkEnumList instance |
|
the value to search for |
Returns : |
TRUE if we found the data in the list
|
gint pk_enum_list_contains_priority (PkEnumList *elist, gint value, ...);
Finds elements in a list, but with priority going to the preceeding entry
|
a valid PkEnumList instance |
|
the values we are searching for |
|
|
Returns : |
The return enumerated type, or -1 if none are found |
gboolean pk_enum_list_append (PkEnumList *elist, guint value);
Set a single item into a list.
|
a valid PkEnumList instance |
|
the value to add |
Returns : |
TRUE if we set the data, FALSE if it already existed
|
gboolean pk_enum_list_remove (PkEnumList *elist, guint value);
Removes a single item from a list.
|
a valid PkEnumList instance |
|
the value to add |
Returns : |
TRUE if we set the data, FALSE if it did not exist
|
gboolean pk_enum_list_print (PkEnumList *elist);
Prints the enumerated list. This is most useful for debugging.
|
a valid PkEnumList instance |
Returns : |
TRUE for success.
|
gboolean pk_enum_list_append_multiple (PkEnumList *elist, gint value, ...);
Set a many items into a list in one method. Always terminate the enum list with the value -1
|
a valid PkEnumList instance |
|
the initial value |
|
|
Returns : |
TRUE if we set the data
|