pk-bitfield
3
PACKAGEKIT Library

# pk-bitfield

## Synopsis

    typedef             PkBitfield;
    #define             PK_BITFIELD_FORMAT
    #define             pk_bitfield_add                     (bitfield,enum)
    #define             pk_bitfield_remove                  (bitfield,enum)
    #define             pk_bitfield_invert                  (bitfield,enum)
    #define             pk_bitfield_contain                 (bitfield,enum)
    #define             pk_bitfield_value                   (enum)
    gint                pk_bitfield_contain_priority        (PkBitfield values,
                                                             gint value,
                                                             ...);
    PkBitfield          pk_bitfield_from_enums              (gint value,
                                                             ...);
    PkBitfield          pk_role_bitfield_from_text          (const gchar *roles);
    gchar *             pk_role_bitfield_to_text            (PkBitfield roles);
    PkBitfield          pk_group_bitfield_from_text         (const gchar *groups);
    gchar *             pk_group_bitfield_to_text           (PkBitfield groups);
    PkBitfield          pk_filter_bitfield_from_text        (const gchar *filters);
    gchar *             pk_filter_bitfield_to_text          (PkBitfield filters);

## Description

## Details

### PkBitfield

    typedef guint64 PkBitfield;

### PK_BITFIELD_FORMAT

    #define PK_BITFIELD_FORMAT G_GUINT64_FORMAT

### pk_bitfield_add()

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

`bitfield` :

`enum` :

### pk_bitfield_remove()

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

`bitfield` :

`enum` :

### pk_bitfield_invert()

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

`bitfield` :

`enum` :

### pk_bitfield_contain()

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

`bitfield` :

`enum` :

### pk_bitfield_value()

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

`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

`values` :

  a valid bitfield instance

`value` :

  the values we are searching for

`...` :

Returns :

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

### pk_bitfield_from_enums ()

    PkBitfield          pk_bitfield_from_enums              (gint value,
                                                             ...);

`value` :

  the values we want to add to the bitfield

`...` :

Returns :

  The return bitfield, or 0 if invalid

### pk_role_bitfield_from_text ()

    PkBitfield          pk_role_bitfield_from_text          (const gchar *roles);

Converts text representation to its enumerated type bitfield

`roles` :

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

Returns :

  The enumerated type values, or 0 for invalid

### pk_role_bitfield_to_text ()

    gchar *             pk_role_bitfield_to_text            (PkBitfield roles);

Converts a enumerated type bitfield to its text representation

`roles` :

  The enumerated type values

Returns :

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

### pk_group_bitfield_from_text ()

    PkBitfield          pk_group_bitfield_from_text         (const gchar *groups);

Converts text representation to its enumerated type bitfield

`groups` :

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

Returns :

  The enumerated type values, or 0 for invalid

### pk_group_bitfield_to_text ()

    gchar *             pk_group_bitfield_to_text           (PkBitfield groups);

`groups` :

Returns :

### pk_filter_bitfield_from_text ()

    PkBitfield          pk_filter_bitfield_from_text        (const gchar *filters);

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

`filters` :

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

Returns :

  The enumerated type values

### pk_filter_bitfield_to_text ()

    gchar *             pk_filter_bitfield_to_text          (PkBitfield filters);

Converts a enumerated type bitfield to its text representation

`filters` :

  The enumerated type values

Returns :

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