Update contrib.
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 2003 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __TEST_COMMON_H__
21 #define __TEST_COMMON_H__
25 #define DEFINE_TYPE_FULL(name, prefix, \
26 class_init, base_init, instance_init, \
27 parent_type, interface_decl) \
29 prefix ## _get_type (void) \
31 static GType object_type = 0; \
35 static const GTypeInfo object_info = \
37 sizeof (name ## Class), \
38 (GBaseInitFunc) base_init, \
39 (GBaseFinalizeFunc) NULL, \
40 (GClassInitFunc) class_init, \
41 (GClassFinalizeFunc) NULL, \
42 NULL, /* class_data */ \
45 (GInstanceInitFunc) instance_init \
48 object_type = g_type_register_static (parent_type, \
57 #define DEFINE_TYPE(name, prefix, \
58 class_init, base_init, instance_init, \
60 DEFINE_TYPE_FULL(name, prefix, class_init, base_init, \
61 instance_init, parent_type, {})
63 #define DEFINE_IFACE(name, prefix, base_init, dflt_init) \
65 prefix ## _get_type (void) \
67 static GType iface_type = 0; \
71 static const GTypeInfo iface_info = \
73 sizeof (name ## Class), \
74 (GBaseInitFunc) base_init, \
75 (GBaseFinalizeFunc) NULL, \
76 (GClassInitFunc) dflt_init, \
79 iface_type = g_type_register_static (G_TYPE_INTERFACE, \
86 #define INTERFACE_FULL(type, init_func, iface_type) \
88 static GInterfaceInfo const iface = \
90 (GInterfaceInitFunc) init_func, NULL, NULL \
93 g_type_add_interface_static (type, iface_type, &iface); \
95 #define INTERFACE(init_func, iface_type) \
96 INTERFACE_FULL(object_type, init_func, iface_type)
100 #endif /* __TEST_COMMON_H__ */