1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 2000 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, see <http://www.gnu.org/licenses/>.
17 #ifndef __G_TYPE_PLUGIN_H__
18 #define __G_TYPE_PLUGIN_H__
20 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
21 #error "Only <glib-object.h> can be included directly."
24 #include <gobject/gtype.h>
28 /* --- type macros --- */
29 #define G_TYPE_TYPE_PLUGIN (g_type_plugin_get_type ())
30 #define G_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TYPE_PLUGIN, GTypePlugin))
31 #define G_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), G_TYPE_TYPE_PLUGIN, GTypePluginClass))
32 #define G_IS_TYPE_PLUGIN(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TYPE_PLUGIN))
33 #define G_IS_TYPE_PLUGIN_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), G_TYPE_TYPE_PLUGIN))
34 #define G_TYPE_PLUGIN_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TYPE_PLUGIN, GTypePluginClass))
37 /* --- typedefs & structures --- */
38 typedef struct _GTypePluginClass GTypePluginClass
;
41 * @plugin: the #GTypePlugin whose use count should be increased
43 * The type of the @use_plugin function of #GTypePluginClass, which gets called
44 * to increase the use count of @plugin.
46 typedef void (*GTypePluginUse
) (GTypePlugin
*plugin
);
49 * @plugin: the #GTypePlugin whose use count should be decreased
51 * The type of the @unuse_plugin function of #GTypePluginClass.
53 typedef void (*GTypePluginUnuse
) (GTypePlugin
*plugin
);
55 * GTypePluginCompleteTypeInfo:
56 * @plugin: the #GTypePlugin
57 * @g_type: the #GType whose info is completed
58 * @info: the #GTypeInfo struct to fill in
59 * @value_table: the #GTypeValueTable to fill in
61 * The type of the @complete_type_info function of #GTypePluginClass.
63 typedef void (*GTypePluginCompleteTypeInfo
) (GTypePlugin
*plugin
,
66 GTypeValueTable
*value_table
);
68 * GTypePluginCompleteInterfaceInfo:
69 * @plugin: the #GTypePlugin
70 * @instance_type: the #GType of an instantiable type to which the interface
72 * @interface_type: the #GType of the interface whose info is completed
73 * @info: the #GInterfaceInfo to fill in
75 * The type of the @complete_interface_info function of #GTypePluginClass.
77 typedef void (*GTypePluginCompleteInterfaceInfo
) (GTypePlugin
*plugin
,
80 GInterfaceInfo
*info
);
84 * The <structname>GTypePlugin</structname> typedef is used as a placeholder
85 * for objects that implement the <structname>GTypePlugin</structname>
90 * @use_plugin: Increases the use count of the plugin.
91 * @unuse_plugin: Decreases the use count of the plugin.
92 * @complete_type_info: Fills in the #GTypeInfo and
93 * #GTypeValueTable structs for the type. The structs are initialized
94 * with <literal>memset(s, 0, sizeof (s))</literal> before calling
96 * @complete_interface_info: Fills in missing parts of the #GInterfaceInfo
97 * for the interface. The structs is initialized with
98 * <literal>memset(s, 0, sizeof (s))</literal> before calling
101 * The #GTypePlugin interface is used by the type system in order to handle
102 * the lifecycle of dynamically loaded types.
104 struct _GTypePluginClass
107 GTypeInterface base_iface
;
110 GTypePluginUse use_plugin
;
111 GTypePluginUnuse unuse_plugin
;
112 GTypePluginCompleteTypeInfo complete_type_info
;
113 GTypePluginCompleteInterfaceInfo complete_interface_info
;
117 /* --- prototypes --- */
118 GLIB_AVAILABLE_IN_ALL
119 GType
g_type_plugin_get_type (void) G_GNUC_CONST
;
120 GLIB_AVAILABLE_IN_ALL
121 void g_type_plugin_use (GTypePlugin
*plugin
);
122 GLIB_AVAILABLE_IN_ALL
123 void g_type_plugin_unuse (GTypePlugin
*plugin
);
124 GLIB_AVAILABLE_IN_ALL
125 void g_type_plugin_complete_type_info (GTypePlugin
*plugin
,
128 GTypeValueTable
*value_table
);
129 GLIB_AVAILABLE_IN_ALL
130 void g_type_plugin_complete_interface_info (GTypePlugin
*plugin
,
132 GType interface_type
,
133 GInterfaceInfo
*info
);
137 #endif /* __G_TYPE_PLUGIN_H__ */