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 GTypePlugin typedef is used as a placeholder
85 * for objects that implement the GTypePlugin interface.
89 * @use_plugin: Increases the use count of the plugin.
90 * @unuse_plugin: Decreases the use count of the plugin.
91 * @complete_type_info: Fills in the #GTypeInfo and
92 * #GTypeValueTable structs for the type. The structs are initialized
93 * with `memset(s, 0, sizeof (s))` before calling this function.
94 * @complete_interface_info: Fills in missing parts of the #GInterfaceInfo
95 * for the interface. The structs is initialized with
96 * `memset(s, 0, sizeof (s))` before calling this function.
98 * The #GTypePlugin interface is used by the type system in order to handle
99 * the lifecycle of dynamically loaded types.
101 struct _GTypePluginClass
104 GTypeInterface base_iface
;
107 GTypePluginUse use_plugin
;
108 GTypePluginUnuse unuse_plugin
;
109 GTypePluginCompleteTypeInfo complete_type_info
;
110 GTypePluginCompleteInterfaceInfo complete_interface_info
;
114 /* --- prototypes --- */
115 GLIB_AVAILABLE_IN_ALL
116 GType
g_type_plugin_get_type (void) G_GNUC_CONST
;
117 GLIB_AVAILABLE_IN_ALL
118 void g_type_plugin_use (GTypePlugin
*plugin
);
119 GLIB_AVAILABLE_IN_ALL
120 void g_type_plugin_unuse (GTypePlugin
*plugin
);
121 GLIB_AVAILABLE_IN_ALL
122 void g_type_plugin_complete_type_info (GTypePlugin
*plugin
,
125 GTypeValueTable
*value_table
);
126 GLIB_AVAILABLE_IN_ALL
127 void g_type_plugin_complete_interface_info (GTypePlugin
*plugin
,
129 GType interface_type
,
130 GInterfaceInfo
*info
);
134 #endif /* __G_TYPE_PLUGIN_H__ */