1 /* comparable.c generated by valac 0.18.0, the Vala compiler
2 * generated from comparable.vala, do not modify */
6 * Copyright (C) 2009 Didier Villevalois
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
27 #include <glib-object.h>
30 #define GEE_TYPE_COMPARABLE (gee_comparable_get_type ())
31 #define GEE_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_COMPARABLE, GeeComparable))
32 #define GEE_IS_COMPARABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_COMPARABLE))
33 #define GEE_COMPARABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GEE_TYPE_COMPARABLE, GeeComparableIface))
35 typedef struct _GeeComparable GeeComparable;
36 typedef struct _GeeComparableIface GeeComparableIface;
38 struct _GeeComparableIface {
39 GTypeInterface parent_iface;
40 gint (*compare_to) (GeeComparable* self, gconstpointer object);
45 GType gee_comparable_get_type (void) G_GNUC_CONST;
46 gint gee_comparable_compare_to (GeeComparable* self, gconstpointer object);
50 * Compares this object with the specifed object.
52 * @return a negative integer, zero, or a positive integer as this object
53 * is less than, equal to, or greater than the specified object
55 gint gee_comparable_compare_to (GeeComparable* self, gconstpointer object) {
56 g_return_val_if_fail (self != NULL, 0);
57 return GEE_COMPARABLE_GET_INTERFACE (self)->compare_to (self, object);
61 static void gee_comparable_base_init (GeeComparableIface * iface) {
62 static gboolean initialized = FALSE;
70 * This interface defines a total ordering among instances of each class
73 GType gee_comparable_get_type (void) {
74 static volatile gsize gee_comparable_type_id__volatile = 0;
75 if (g_once_init_enter (&gee_comparable_type_id__volatile)) {
76 static const GTypeInfo g_define_type_info = { sizeof (GeeComparableIface), (GBaseInitFunc) gee_comparable_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
77 GType gee_comparable_type_id;
78 gee_comparable_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeComparable", &g_define_type_info, 0);
79 g_type_interface_add_prerequisite (gee_comparable_type_id, G_TYPE_OBJECT);
80 g_once_init_leave (&gee_comparable_type_id__volatile, gee_comparable_type_id);
82 return gee_comparable_type_id__volatile;