Top | ![]() |
![]() |
![]() |
![]() |
GDataComparable is implemented by GDataAuthor, GDataCategory, GDataDocumentsProperty, GDataGContactCalendar, GDataGContactExternalID, GDataGContactLanguage, GDataGContactWebsite, GDataGDEmailAddress, GDataGDIMAddress, GDataGDName, GDataGDOrganization, GDataGDPhoneNumber, GDataGDPostalAddress, GDataGDReminder, GDataGDWhen, GDataGDWhere, GDataGDWho, GDataGenerator, GDataLink and GDataYouTubeCategory.
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
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.
self |
a GDataComparable, or |
[allow-none] |
other |
another GDataComparable of the same type, or |
[allow-none] |
Since: 0.7.0
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 |
the parent type |
|
compares the object with an |
Since: 0.7.0