Update Changelog
[profile/ivi/libgee.git] / gee / comparable.c
1 /* comparable.c generated by valac 0.18.0, the Vala compiler
2  * generated from comparable.vala, do not modify */
3
4 /* comparable.vala
5  *
6  * Copyright (C) 2009  Didier Villevalois
7  *
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.
12
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.
17
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
21  *
22  * Author:
23  *      Didier 'Ptitjes Villevalois <ptitjes@free.fr>
24  */
25
26 #include <glib.h>
27 #include <glib-object.h>
28
29
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))
34
35 typedef struct _GeeComparable GeeComparable;
36 typedef struct _GeeComparableIface GeeComparableIface;
37
38 struct _GeeComparableIface {
39         GTypeInterface parent_iface;
40         gint (*compare_to) (GeeComparable* self, gconstpointer object);
41 };
42
43
44
45 GType gee_comparable_get_type (void) G_GNUC_CONST;
46 gint gee_comparable_compare_to (GeeComparable* self, gconstpointer object);
47
48
49 /**
50  * Compares this object with the specifed object.
51  *
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
54  */
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);
58 }
59
60
61 static void gee_comparable_base_init (GeeComparableIface * iface) {
62         static gboolean initialized = FALSE;
63         if (!initialized) {
64                 initialized = TRUE;
65         }
66 }
67
68
69 /**
70  * This interface defines a total ordering among instances of each class
71  * implementing it.
72  *
73  * @see Hashable
74  */
75 GType gee_comparable_get_type (void) {
76         static volatile gsize gee_comparable_type_id__volatile = 0;
77         if (g_once_init_enter (&gee_comparable_type_id__volatile)) {
78                 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 };
79                 GType gee_comparable_type_id;
80                 gee_comparable_type_id = g_type_register_static (G_TYPE_INTERFACE, "GeeComparable", &g_define_type_info, 0);
81                 g_type_interface_add_prerequisite (gee_comparable_type_id, G_TYPE_OBJECT);
82                 g_once_init_leave (&gee_comparable_type_id__volatile, gee_comparable_type_id);
83         }
84         return gee_comparable_type_id__volatile;
85 }
86
87
88