source: appstream-generator/build/girepo/gobject/TypePluginT.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 4.8 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software 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
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gobject.TypePluginT;
22
23public  import gi.gobject;
24public  import gi.gobjecttypes;
25
26
27/**
28 * The GObject type system supports dynamic loading of types.
29 * The #GTypePlugin interface is used to handle the lifecycle
30 * of dynamically loaded types. It goes as follows:
31 *
32 * 1. The type is initially introduced (usually upon loading the module
33 * the first time, or by your main application that knows what modules
34 * introduces what types), like this:
35 * |[<!-- language="C" -->
36 * new_type_id = g_type_register_dynamic (parent_type_id,
37 * "TypeName",
38 * new_type_plugin,
39 * type_flags);
40 * ]|
41 * where @new_type_plugin is an implementation of the
42 * #GTypePlugin interface.
43 *
44 * 2. The type's implementation is referenced, e.g. through
45 * g_type_class_ref() or through g_type_create_instance() (this is
46 * being called by g_object_new()) or through one of the above done on
47 * a type derived from @new_type_id.
48 *
49 * 3. This causes the type system to load the type's implementation by
50 * calling g_type_plugin_use() and g_type_plugin_complete_type_info()
51 * on @new_type_plugin.
52 *
53 * 4. At some point the type's implementation isn't required anymore,
54 * e.g. after g_type_class_unref() or g_type_free_instance() (called
55 * when the reference count of an instance drops to zero).
56 *
57 * 5. This causes the type system to throw away the information retrieved
58 * from g_type_plugin_complete_type_info() and then it calls
59 * g_type_plugin_unuse() on @new_type_plugin.
60 *
61 * 6. Things may repeat from the second step.
62 *
63 * So basically, you need to implement a #GTypePlugin type that
64 * carries a use_count, once use_count goes from zero to one, you need
65 * to load the implementation to successfully handle the upcoming
66 * g_type_plugin_complete_type_info() call. Later, maybe after
67 * succeeding use/unuse calls, once use_count drops to zero, you can
68 * unload the implementation again. The type system makes sure to call
69 * g_type_plugin_use() and g_type_plugin_complete_type_info() again
70 * when the type is needed again.
71 *
72 * #GTypeModule is an implementation of #GTypePlugin that already
73 * implements most of this except for the actual module loading and
74 * unloading. It even handles multiple registered types per module.
75 */
76public template TypePluginT(TStruct)
77{
78        /** Get the main Gtk struct */
79        public GTypePlugin* getTypePluginStruct()
80        {
81                return cast(GTypePlugin*)getStruct();
82        }
83
84
85        /**
86         * Calls the @complete_interface_info function from the
87         * #GTypePluginClass of @plugin. There should be no need to use this
88         * function outside of the GObject type system itself.
89         *
90         * Params:
91         *     instanceType = the #GType of an instantiable type to which the interface
92         *         is added
93         *     interfaceType = the #GType of the interface whose info is completed
94         *     info = the #GInterfaceInfo to fill in
95         */
96        public void completeInterfaceInfo(GType instanceType, GType interfaceType, GInterfaceInfo* info)
97        {
98                g_type_plugin_complete_interface_info(getTypePluginStruct(), instanceType, interfaceType, info);
99        }
100
101        /**
102         * Calls the @complete_type_info function from the #GTypePluginClass of @plugin.
103         * There should be no need to use this function outside of the GObject
104         * type system itself.
105         *
106         * Params:
107         *     gType = the #GType whose info is completed
108         *     info = the #GTypeInfo struct to fill in
109         *     valueTable = the #GTypeValueTable to fill in
110         */
111        public void completeTypeInfo(GType gType, GTypeInfo* info, GTypeValueTable* valueTable)
112        {
113                g_type_plugin_complete_type_info(getTypePluginStruct(), gType, info, valueTable);
114        }
115
116        /**
117         * Calls the @unuse_plugin function from the #GTypePluginClass of
118         * @plugin.  There should be no need to use this function outside of
119         * the GObject type system itself.
120         */
121        public void unuse()
122        {
123                g_type_plugin_unuse(getTypePluginStruct());
124        }
125
126        /**
127         * Calls the @use_plugin function from the #GTypePluginClass of
128         * @plugin.  There should be no need to use this function outside of
129         * the GObject type system itself.
130         */
131        public void use()
132        {
133                g_type_plugin_use(getTypePluginStruct());
134        }
135}
Note: See TracBrowser for help on using the repository browser.