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

GDataComparable

GDataComparable — GData comparable interface

Stability Level

Stable, unless otherwise indicated

Types and Values

Object Hierarchy

    GInterface
    ╰── GDataComparable

Includes

#include <gdata/gdata-comparable.h>

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

pure .

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

[allow-none]

other

another GDataComparable of the same type, or NULL.

[allow-none]

Returns

TRUE on success, FALSE otherwise

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

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