PolkitIdentity

## PolkitIdentity PolkitIdentity — Type for representing identities |

## Synopsis

                        PolkitIdentity;
    struct              PolkitIdentityIface;
    guint               polkit_identity_hash                (PolkitIdentity *identity);
    gboolean            polkit_identity_equal               (PolkitIdentity *a,
                                                             PolkitIdentity *b);
    gchar *             polkit_identity_to_string           (PolkitIdentity *identity);
    PolkitIdentity *    polkit_identity_from_string         (const gchar *str,
                                                             GError **error);

## Object Hierarchy

      GInterface
       +----PolkitIdentity

## Prerequisites

PolkitIdentity requires GObject.

## Known Implementations

PolkitIdentity is implemented by PolkitUnixGroup, PolkitUnixNetgroup and PolkitUnixUser.

## Description

PolkitIdentity is an abstract type for representing one or more identities.

## Details

### PolkitIdentity

    typedef struct _PolkitIdentity PolkitIdentity;

Generic type for all objects that can be used as identities.

### struct PolkitIdentityIface

    struct PolkitIdentityIface {
      GTypeInterface parent_iface;

      guint    (*hash)      (PolkitIdentity *identity);

      gboolean (*equal)     (PolkitIdentity *a,
                             PolkitIdentity *b);

      gchar *  (*to_string) (PolkitIdentity *identity);
    };

An interface for identities.

GTypeInterface `parent_iface`; | The parent interface.
`hash` () | Gets a hash value for a PolkitIdentity.
`equal` () | Checks if two PolkitIdentitys are equal.
`to_string` () | Serializes a PolkitIdentity to a string that can be used in `polkit_identity_from_string()`.

### polkit_identity_hash ()

    guint               polkit_identity_hash                (PolkitIdentity *identity);

Gets a hash code for `identity` that can be used with e.g. `g_hash_table_new()`.

`identity` : | A PolkitIdentity.
Returns : | A hash code.

### polkit_identity_equal ()

    gboolean            polkit_identity_equal               (PolkitIdentity *a,
                                                             PolkitIdentity *b);

Checks if `a` and `b` are equal, ie. represent the same identity.

This function can be used in e.g. `g_hash_table_new()`.

`a` : | A PolkitIdentity.
`b` : | A PolkitIdentity.
Returns : | `TRUE` if `a` and `b` are equal, `FALSE` otherwise.

### polkit_identity_to_string ()

    gchar *             polkit_identity_to_string           (PolkitIdentity *identity);

Serializes `identity` to a string that can be used in `polkit_identity_from_string()`.

`identity` : | A PolkitIdentity.
Returns : | A string representing `identity`. Free with `g_free()`.

### polkit_identity_from_string ()

    PolkitIdentity *    polkit_identity_from_string         (const gchar *str,
                                                             GError **error);

Creates an object from `str` that implements the PolkitIdentity interface.

`str` : | A string obtained from `polkit_identity_to_string()`.
`error` : | Return location for error.
Returns : | A PolkitIdentity or `NULL` if `error` is set. Free with `g_object_unref()`. [allow-none][transfer full]