source: appstream-generator/build/girepo/gio/IOModule.d @ 4841

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

Initial release

File size: 6.1 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 gio.IOModule;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.IOModuleScope;
26private import glib.ConstructionException;
27private import glib.ListG;
28private import glib.Str;
29private import gobject.ObjectG;
30private import gobject.TypeModule;
31private import gobject.TypePluginIF;
32private import gobject.TypePluginT;
33
34
35/**
36 * Provides an interface and default functions for loading and unloading
37 * modules. This is used internally to make GIO extensible, but can also
38 * be used by others to implement module loading.
39 */
40public class IOModule : TypeModule
41{
42        /** the main Gtk struct */
43        protected GIOModule* gIOModule;
44
45        /** Get the main Gtk struct */
46        public GIOModule* getIOModuleStruct()
47        {
48                return gIOModule;
49        }
50
51        /** the main Gtk struct as a void* */
52        protected override void* getStruct()
53        {
54                return cast(void*)gIOModule;
55        }
56
57        protected override void setStruct(GObject* obj)
58        {
59                gIOModule = cast(GIOModule*)obj;
60                super.setStruct(obj);
61        }
62
63        /**
64         * Sets our main struct and passes it to the parent class.
65         */
66        public this (GIOModule* gIOModule, bool ownedRef = false)
67        {
68                this.gIOModule = gIOModule;
69                super(cast(GTypeModule*)gIOModule, ownedRef);
70        }
71
72
73        /** */
74        public static GType getType()
75        {
76                return g_io_module_get_type();
77        }
78
79        /**
80         * Creates a new GIOModule that will load the specific
81         * shared library when in use.
82         *
83         * Params:
84         *     filename = filename of the shared library module.
85         *
86         * Returns: a #GIOModule from given @filename,
87         *     or %NULL on error.
88         *
89         * Throws: ConstructionException GTK+ fails to create the object.
90         */
91        public this(string filename)
92        {
93                auto p = g_io_module_new(Str.toStringz(filename));
94               
95                if(p is null)
96                {
97                        throw new ConstructionException("null returned by new");
98                }
99               
100                this(cast(GIOModule*) p, true);
101        }
102
103        /**
104         * Loads all the modules in the specified directory.
105         *
106         * If don't require all modules to be initialized (and thus registering
107         * all gtypes) then you can use g_io_modules_scan_all_in_directory()
108         * which allows delayed/lazy loading of modules.
109         *
110         * Params:
111         *     dirname = pathname for a directory containing modules to load.
112         *
113         * Returns: a list of #GIOModules loaded
114         *     from the directory,
115         *     All the modules are loaded into memory, if you want to
116         *     unload them (enabling on-demand loading) you must call
117         *     g_type_module_unuse() on all the modules. Free the list
118         *     with g_list_free().
119         */
120        public static ListG loadAllInDirectory(string dirname)
121        {
122                auto p = g_io_modules_load_all_in_directory(Str.toStringz(dirname));
123               
124                if(p is null)
125                {
126                        return null;
127                }
128               
129                return new ListG(cast(GList*) p, true);
130        }
131
132        /**
133         * Loads all the modules in the specified directory.
134         *
135         * If don't require all modules to be initialized (and thus registering
136         * all gtypes) then you can use g_io_modules_scan_all_in_directory()
137         * which allows delayed/lazy loading of modules.
138         *
139         * Params:
140         *     dirname = pathname for a directory containing modules to load.
141         *     scop = a scope to use when scanning the modules.
142         *
143         * Returns: a list of #GIOModules loaded
144         *     from the directory,
145         *     All the modules are loaded into memory, if you want to
146         *     unload them (enabling on-demand loading) you must call
147         *     g_type_module_unuse() on all the modules. Free the list
148         *     with g_list_free().
149         *
150         * Since: 2.30
151         */
152        public static ListG loadAllInDirectoryWithScope(string dirname, IOModuleScope scop)
153        {
154                auto p = g_io_modules_load_all_in_directory_with_scope(Str.toStringz(dirname), (scop is null) ? null : scop.getIOModuleScopeStruct());
155               
156                if(p is null)
157                {
158                        return null;
159                }
160               
161                return new ListG(cast(GList*) p, true);
162        }
163
164        /**
165         * Scans all the modules in the specified directory, ensuring that
166         * any extension point implemented by a module is registered.
167         *
168         * This may not actually load and initialize all the types in each
169         * module, some modules may be lazily loaded and initialized when
170         * an extension point it implementes is used with e.g.
171         * g_io_extension_point_get_extensions() or
172         * g_io_extension_point_get_extension_by_name().
173         *
174         * If you need to guarantee that all types are loaded in all the modules,
175         * use g_io_modules_load_all_in_directory().
176         *
177         * Params:
178         *     dirname = pathname for a directory containing modules to scan.
179         *
180         * Since: 2.24
181         */
182        public static void scanAllInDirectory(string dirname)
183        {
184                g_io_modules_scan_all_in_directory(Str.toStringz(dirname));
185        }
186
187        /**
188         * Scans all the modules in the specified directory, ensuring that
189         * any extension point implemented by a module is registered.
190         *
191         * This may not actually load and initialize all the types in each
192         * module, some modules may be lazily loaded and initialized when
193         * an extension point it implementes is used with e.g.
194         * g_io_extension_point_get_extensions() or
195         * g_io_extension_point_get_extension_by_name().
196         *
197         * If you need to guarantee that all types are loaded in all the modules,
198         * use g_io_modules_load_all_in_directory().
199         *
200         * Params:
201         *     dirname = pathname for a directory containing modules to scan.
202         *     scop = a scope to use when scanning the modules
203         *
204         * Since: 2.30
205         */
206        public static void scanAllInDirectoryWithScope(string dirname, IOModuleScope scop)
207        {
208                g_io_modules_scan_all_in_directory_with_scope(Str.toStringz(dirname), (scop is null) ? null : scop.getIOModuleScopeStruct());
209        }
210}
Note: See TracBrowser for help on using the repository browser.