## GcrComparable GcrComparable — Interface for comparing objects |

## Functions

gint | gcr_comparable_compare ()
gint | gcr_comparable_memcmp ()

## Types and Values

| GcrComparable
struct | GcrComparableIface

## Object Hierarchy

        GInterface
        ╰── GcrComparable

## Prerequisites

GcrComparable requires GObject.

## Known Derived Interfaces

GcrComparable is required by GcrCertificate.

## Known Implementations

GcrComparable is implemented by GcrCertificateRenderer, GcrPkcs11Certificate and GcrSimpleCertificate.

## Description

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

## Functions

### 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.

#### Parameters

self | The comparable object |
other | Another comparable object. | [allow-none]

#### 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.

[skip]

#### Parameters

mem1 | First block of memory. | [array length=size1][element-type guint8]
size1 | Length of first block |
mem2 | Second block of memory. | [array length=size2][element-type guint8]
size2 | Length of second block |

#### Returns

Zero if the blocks are identical, negative if first less than secend, possitive otherwise.

## Types and Values

### GcrComparable

    typedef struct _GcrComparable GcrComparable;

The GcrComparable interface is implemented by comparable objects.

### struct GcrComparableIface

    struct GcrComparableIface {
    	GTypeInterface parent;
    	gint (*compare) (GcrComparable *self, GcrComparable *other);
    };

The interface to implement for GcrComparable

#### Members

GTypeInterface `parent`; | type interface |
`compare` () | Compare whether tow objects represent the same thing. |