Top |
Known Implementations
GDataComparable is implemented by GDataAuthor, GDataCategory, GDataGContactCalendar, GDataGContactExternalID, GDataGContactLanguage, GDataGContactWebsite, GDataGDEmailAddress, GDataGDIMAddress, GDataGDName, GDataGDOrganization, GDataGDPhoneNumber, GDataGDPostalAddress, GDataGDReminder, GDataGDWhen, GDataGDWhere, GDataGDWho, GDataGenerator, GDataLink and GDataYouTubeCategory.
Description
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
Functions
gdata_comparable_compare ()
gint 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.
Parameters
self |
a GDataComparable, or |
[allow-none] |
other |
another GDataComparable of the same type, or |
[allow-none] |
Since: 0.7.0
Types and Values
GDataComparable
typedef struct _GDataComparable GDataComparable;
All the fields in the GDataComparable structure are private and should never be accessed directly.
Since: 0.7.0
GDataComparableIface
typedef struct { GTypeInterface parent; gint (*compare_with) (GDataComparable *self, GDataComparable *other); } GDataComparableIface;
The class structure for the GDataComparable interface.
Members
GTypeInterface |
the parent type |
|
compares the object with an |
Since: 0.7.0