X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gobject%2Fgtypemodule.h;h=e4cae1a0cdc5d214777f0ae46032d57be696597c;hb=2e5bd8cf47f9e1559ccc44823a2f321b8ff8c1ea;hp=464531c73719a60d7e81a1e8fc41d0295356a047;hpb=b35fa1994d6607376136716c133dd88433706ee8;p=platform%2Fupstream%2Fglib.git diff --git a/gobject/gtypemodule.h b/gobject/gtypemodule.h index 464531c..e4cae1a 100644 --- a/gobject/gtypemodule.h +++ b/gobject/gtypemodule.h @@ -12,17 +12,15 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library; if not, see . */ +#ifndef __G_TYPE_MODULE_H__ +#define __G_TYPE_MODULE_H__ + #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) #error "Only can be included directly." #endif -#ifndef __G_TYPE_MODULE_H__ -#define __G_TYPE_MODULE_H__ - #include #include @@ -42,7 +40,7 @@ typedef struct _GTypeModuleClass GTypeModuleClass; * GTypeModule: * @name: the name of the module * - * The members of the GTypeModule structure should not + * The members of the GTypeModule structure should not * be accessed directly, except for the @name field. */ struct _GTypeModule @@ -94,9 +92,9 @@ struct _GTypeModuleClass * class initialization function, an instance initialization function (see * #GTypeInfo for information about these) and a static variable named * @t_n_parent_class pointing to the parent class. Furthermore, - * it defines a *_get_type() and a static - * *_register_type() function for use in your - * module_init(). + * it defines a `*_get_type()` and a static `*_register_type()` functions + * for use in your `module_init()`. + * * See G_DEFINE_DYNAMIC_TYPE_EXTENDED() for an example. * * Since: 2.14 @@ -160,7 +158,7 @@ struct _GTypeModuleClass * }; * gtk_gadget_type_id = g_type_module_register_type (type_module, * GTK_TYPE_THING, - * GtkGadget, + * "GtkGadget", * &g_define_type_info, * (GTypeFlags) flags); * { @@ -180,11 +178,16 @@ static void type_name##_class_init (TypeName##Class *klass); \ static void type_name##_class_finalize (TypeName##Class *klass); \ static gpointer type_name##_parent_class = NULL; \ static GType type_name##_type_id = 0; \ -static void type_name##_class_intern_init (gpointer klass) \ +static gint TypeName##_private_offset; \ +\ +_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \ +\ +static inline gpointer \ +type_name##_get_instance_private (TypeName *self) \ { \ - type_name##_parent_class = g_type_class_peek_parent (klass); \ - type_name##_class_init ((TypeName##Class*) klass); \ + return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \ } \ +\ GType \ type_name##_get_type (void) \ { \ @@ -193,7 +196,7 @@ type_name##_get_type (void) \ static void \ type_name##_register_type (GTypeModule *type_module) \ { \ - GType g_define_type_id; \ + GType g_define_type_id G_GNUC_UNUSED; \ const GTypeInfo g_define_type_info = { \ sizeof (TypeName##Class), \ (GBaseInitFunc) NULL, \ @@ -237,23 +240,35 @@ type_name##_register_type (GTypeModule *type_module) \ g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ } +#define G_ADD_PRIVATE_DYNAMIC(TypeName) { \ + TypeName##_private_offset = sizeof (TypeName##Private); \ +} + +GLIB_AVAILABLE_IN_ALL GType g_type_module_get_type (void) G_GNUC_CONST; +GLIB_AVAILABLE_IN_ALL gboolean g_type_module_use (GTypeModule *module); +GLIB_AVAILABLE_IN_ALL void g_type_module_unuse (GTypeModule *module); +GLIB_AVAILABLE_IN_ALL void g_type_module_set_name (GTypeModule *module, const gchar *name); +GLIB_AVAILABLE_IN_ALL GType g_type_module_register_type (GTypeModule *module, GType parent_type, const gchar *type_name, const GTypeInfo *type_info, GTypeFlags flags); +GLIB_AVAILABLE_IN_ALL void g_type_module_add_interface (GTypeModule *module, GType instance_type, GType interface_type, const GInterfaceInfo *interface_info); +GLIB_AVAILABLE_IN_ALL GType g_type_module_register_enum (GTypeModule *module, const gchar *name, const GEnumValue *const_static_values); +GLIB_AVAILABLE_IN_ALL GType g_type_module_register_flags (GTypeModule *module, const gchar *name, const GFlagsValue *const_static_values);