## GcrComparable

GcrComparable — Interface for comparing objects

## Synopsis

                        GcrComparable;
    struct              GcrComparableIface;
    gint                gcr_comparable_compare              (GcrComparable *self,
                                                             GcrComparable *other);
    gint                gcr_comparable_memcmp               (gconstpointer mem1,
                                                             gsize size1,
                                                             gconstpointer mem2,
                                                             gsize size2);

## Object Hierarchy

      GInterface
       +----GcrComparableIface

## Prerequisites

GcrComparableIface requires GObject.

## Known Derived Interfaces

GcrComparableIface is required by GcrCertificate.

## Known Implementations

GcrComparableIface is implemented by GcrCertificateRenderer, GcrPkcs11Certificate and GcrSimpleCertificate.

## Description

The GcrComparable interface is implemented by objects when they should be comparable against one another.

## Details

### GcrComparable

    typedef struct _GcrComparable GcrComparable;

The GcrComparable interface is implemented by comparable objects.

### struct GcrComparableIface

    struct GcrComparableIface;

The interface to implement for GcrComparable

### gcr_comparable_compare ()

    gint                gcr_comparable_compare              (GcrComparable *self,
                                                             GcrComparable *other);

Compare whether two objects represent the same thing. The return value can also be used to sort the objects.

`self` : | The comparable object
`other` : | Another comparable object
Returns : | Zero if the two objects represent the same thing, non-zero if not.

### gcr_comparable_memcmp ()

    gint                gcr_comparable_memcmp               (gconstpointer mem1,
                                                             gsize size1,
                                                             gconstpointer mem2,
                                                             gsize size2);

Compare two blocks of memory. The return value can be used to sort the blocks of memory.

`mem1` : | First block of memory
`size1` : | Length of first block
`mem2` : | Second lock of memory
`size2` : | Length of second block
Returns : | Zero if the blocks are identical, non-zero if not.