1/* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 2000 Red Hat, Inc.
3 *
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.1 of the License, or (at your option) any later version.
8 *
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.
13 *
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/>.
16 */
17#ifndef __G_TYPE_PLUGIN_H__
18#define __G_TYPE_PLUGIN_H__
19
20#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
21#error "Only <glib-object.h> can be included directly."
22#endif
23
24#include <gobject/gtype.h>
25
26G_BEGIN_DECLS
27
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))
35
36
37/* --- typedefs & structures --- */
38typedef struct _GTypePluginClass GTypePluginClass;
39/**
40 * GTypePluginUse:
41 * @plugin: the #GTypePlugin whose use count should be increased
42 *
43 * The type of the @use_plugin function of #GTypePluginClass, which gets called
44 * to increase the use count of @plugin.
45 */
46typedef void (*GTypePluginUse) (GTypePlugin *plugin);
47/**
48 * GTypePluginUnuse:
49 * @plugin: the #GTypePlugin whose use count should be decreased
50 *
51 * The type of the @unuse_plugin function of #GTypePluginClass.
52 */
53typedef void (*GTypePluginUnuse) (GTypePlugin *plugin);
54/**
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
60 *
61 * The type of the @complete_type_info function of #GTypePluginClass.
62 */
63typedef void (*GTypePluginCompleteTypeInfo) (GTypePlugin *plugin,
64 GType g_type,
65 GTypeInfo *info,
66 GTypeValueTable *value_table);
67/**
68 * GTypePluginCompleteInterfaceInfo:
69 * @plugin: the #GTypePlugin
70 * @instance_type: the #GType of an instantiable type to which the interface
71 * is added
72 * @interface_type: the #GType of the interface whose info is completed
73 * @info: the #GInterfaceInfo to fill in
74 *
75 * The type of the @complete_interface_info function of #GTypePluginClass.
76 */
77typedef void (*GTypePluginCompleteInterfaceInfo) (GTypePlugin *plugin,
78 GType instance_type,
79 GType interface_type,
80 GInterfaceInfo *info);
81/**
82 * GTypePlugin:
83 *
84 * The GTypePlugin typedef is used as a placeholder
85 * for objects that implement the GTypePlugin interface.
86 */
87/**
88 * GTypePluginClass:
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.
97 *
98 * The #GTypePlugin interface is used by the type system in order to handle
99 * the lifecycle of dynamically loaded types.
100 */
101struct _GTypePluginClass
102{
103 /*< private >*/
104 GTypeInterface base_iface;
105
106 /*< public >*/
107 GTypePluginUse use_plugin;
108 GTypePluginUnuse unuse_plugin;
109 GTypePluginCompleteTypeInfo complete_type_info;
110 GTypePluginCompleteInterfaceInfo complete_interface_info;
111};
112
113
114/* --- prototypes --- */
115GLIB_AVAILABLE_IN_ALL
116GType g_type_plugin_get_type (void) G_GNUC_CONST;
117GLIB_AVAILABLE_IN_ALL
118void g_type_plugin_use (GTypePlugin *plugin);
119GLIB_AVAILABLE_IN_ALL
120void g_type_plugin_unuse (GTypePlugin *plugin);
121GLIB_AVAILABLE_IN_ALL
122void g_type_plugin_complete_type_info (GTypePlugin *plugin,
123 GType g_type,
124 GTypeInfo *info,
125 GTypeValueTable *value_table);
126GLIB_AVAILABLE_IN_ALL
127void g_type_plugin_complete_interface_info (GTypePlugin *plugin,
128 GType instance_type,
129 GType interface_type,
130 GInterfaceInfo *info);
131
132G_END_DECLS
133
134#endif /* __G_TYPE_PLUGIN_H__ */
135