| GData Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Known Implementations | ||||
#include <gdata/gdata-comparable.h>
GDataComparable;
GDataComparableIface;
gint gdata_comparable_compare (GDataComparable *self,
GDataComparable *other);
GDataComparable is implemented by GDataAuthor, GDataCategory, 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
pure
.
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 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
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.
|
a GDataComparable, or NULL. [allow-none]
|
|
another GDataComparable of the same type, or NULL. [allow-none]
|
Returns : |
TRUE on success, FALSE otherwise |
Since 0.7.0