PackageKit Reference Manual: pk-bitfield

## pk-bitfield pk-bitfield |

## Functions

#define | pk_bitfield_add()
#define | pk_bitfield_remove()
#define | pk_bitfield_invert()
#define | pk_bitfield_contain()
#define | pk_bitfield_value()
gint | pk_bitfield_contain_priority ()
PkBitfield | pk_bitfield_from_enums ()
PkBitfield | pk_role_bitfield_from_string ()
gchar * | pk_role_bitfield_to_string ()
PkBitfield | pk_group_bitfield_from_string ()
gchar * | pk_group_bitfield_to_string ()
PkBitfield | pk_filter_bitfield_from_string ()
gchar * | pk_filter_bitfield_to_string ()
PkBitfield | pk_transaction_flag_bitfield_from_string ()
gchar * | pk_transaction_flag_bitfield_to_string ()
void | pk_bitfield_test ()

## Types and Values

typedef | PkBitfield
#define | PK_BITFIELD_FORMAT

## Object Hierarchy

## Description

## Functions

### pk_bitfield_add()

    #define pk_bitfield_add(bitfield,enum)		do { ((bitfield) |= (pk_bitfield_value(enum))); } while (0)

### pk_bitfield_remove()

    #define pk_bitfield_remove(bitfield,enum) do { ((bitfield) &= ~(pk_bitfield_value(enum))); } while (0)

### pk_bitfield_invert()

    #define pk_bitfield_invert(bitfield,enum) do { ((bitfield) ^= (pk_bitfield_value(enum))); } while (0)

### pk_bitfield_contain()

    #define pk_bitfield_contain(bitfield,enum) (((bitfield) & (pk_bitfield_value(enum))) > 0)

### pk_bitfield_value()

    #define pk_bitfield_value(enum)			((PkBitfield) 1 << (enum))

### pk_bitfield_contain_priority ()

    gint
    pk_bitfield_contain_priority (PkBitfield values,
                                  gint value,
                                  ...);

Finds elements in a list, but with priority going to the preceeding entry

#### Parameters

values | a valid bitfield instance |
value | the values we are searching for |

#### Returns

The return enumerated type, or -1 if none are found

Since 0.5.2

### pk_bitfield_from_enums ()

    PkBitfield
    pk_bitfield_from_enums (gint value,
                            ...);

#### Parameters

value | the values we want to add to the bitfield |

#### Returns

The return bitfield, or 0 if invalid

Since 0.5.2

### pk_role_bitfield_from_string ()

    PkBitfield
    pk_role_bitfield_from_string (const gchar *roles);

Converts text representation to its enumerated type bitfield

#### Parameters

roles | the enumerated constant value, e.g. "search-file;update-system" |

#### Returns

The enumerated type values, or 0 for invalid

Since 0.5.2

### pk_role_bitfield_to_string ()

    gchar *
    pk_role_bitfield_to_string (PkBitfield roles);

Converts a enumerated type bitfield to its text representation

#### Parameters

roles | The enumerated type values |

#### Returns

the enumerated constant value, e.g. "install-file;update-system"

Since 0.5.2

### pk_group_bitfield_from_string ()

    PkBitfield
    pk_group_bitfield_from_string (const gchar *groups);

Converts text representation to its enumerated type bitfield

#### Parameters

groups | the enumerated constant value, e.g. "available;~gui" |

#### Returns

The enumerated type values, or 0 for invalid

Since 0.5.2

### pk_group_bitfield_to_string ()

    gchar *
    pk_group_bitfield_to_string (PkBitfield groups);

### pk_filter_bitfield_from_string ()

    PkBitfield
    pk_filter_bitfield_from_string (const gchar *filters);

Converts text representation to its enumerated type bitfield, or 0 for invalid

#### Parameters

filters | the enumerated constant value, e.g. "available;~gui" |

#### Returns

The enumerated type values

Since 0.5.2

### pk_filter_bitfield_to_string ()

    gchar *
    pk_filter_bitfield_to_string (PkBitfield filters);

Converts a enumerated type bitfield to its text representation

#### Parameters

filters | The enumerated type values |

#### Returns

the enumerated constant value, e.g. "available;~gui"

Since 0.5.2

### pk_transaction_flag_bitfield_from_string ()

    PkBitfield
    pk_transaction_flag_bitfield_from_string
                                   (const gchar *transaction_flags);

Converts text representation to its enumerated type bitfield, or 0 for invalid

#### Parameters

transaction_flags | the enumerated constant value, e.g. "only-trusted;simulate" |

#### Returns

The enumerated type values

Since 0.8.1

### pk_transaction_flag_bitfield_to_string ()

    gchar *
    pk_transaction_flag_bitfield_to_string
                                   (PkBitfield transaction_flags);

Converts a enumerated type bitfield to its text representation

#### Parameters

transaction_flags | The enumerated type values |

#### Returns

the enumerated constant value, e.g. "only-trusted;simulate"

Since 0.8.1

### pk_bitfield_test ()

    void
    pk_bitfield_test (gpointer user_data);

## Types and Values

### PkBitfield

    typedef guint64 PkBitfield;

### PK_BITFIELD_FORMAT

    #define PK_BITFIELD_FORMAT G_GUINT64_FORMAT