manpagez: man pages & more
html files: gdata
Home | html | info | man


GDataComparable — GData comparable interface

Stability Level

Stable, unless otherwise indicated

Types and Values

Object Hierarchy

    ╰── GDataComparable


#include <gdata/gdata-comparable.h>


GDataComparable is an interface which can be implemented by any object which needs to be compared to another object of the same type or of a derived type.

When implementing the interface, classes must implement the compare_with function, and the implementation must be

pure .


gdata_comparable_compare ()

gdata_comparable_compare (GDataComparable *self,
                          GDataComparable *other);

Compares the two objects, returning -1 if self is "less than" other by some metric, 0 if they're equal, or 1 if self is "greater than" other .

NULL values are handled gracefully, with 0 returned if both self and other are NULL,

-1 if self is NULL and 1 if other is NULL.

The other object must be of the same type as self , or of a type derived from self 's type.



a GDataComparable, or NULL.



another GDataComparable of the same type, or NULL.



TRUE on success, FALSE otherwise

Since: 0.7.0

Types and Values


typedef struct _GDataComparable GDataComparable;

All the fields in the GDataComparable structure are private and should never be accessed directly.

Since: 0.7.0


typedef struct {
	GTypeInterface parent;

	gint (*compare_with) (GDataComparable *self, GDataComparable *other);
} GDataComparableIface;

The class structure for the GDataComparable interface.


GTypeInterface parent;

the parent type


compare_with ()

compares the object with an other object of the same type, returning -1 if the object is "less than" the other object, 0 if they're equal, or 1 if the object is "greater than" the other. The function can assume that neither self or other will be NULL, and that both have correct types. The function must be pure.


Since: 0.7.0

© 2000-2024
Individual documents may contain additional copyright information.