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

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

Initial release

File size: 4.9 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.ParamSpecPool;
22
23private import gi.gobject;
24public  import gi.gobjecttypes;
25private import glib.ConstructionException;
26private import glib.ListG;
27private import glib.Str;
28private import gobject.ObjectG;
29private import gobject.ParamSpec;
30
31
32/**
33 * A #GParamSpecPool maintains a collection of #GParamSpecs which can be
34 * quickly accessed by owner and name. The implementation of the #GObject property
35 * system uses such a pool to store the #GParamSpecs of the properties all object
36 * types.
37 */
38public class ParamSpecPool
39{
40        /** the main Gtk struct */
41        protected GParamSpecPool* gParamSpecPool;
42        protected bool ownedRef;
43
44        /** Get the main Gtk struct */
45        public GParamSpecPool* getParamSpecPoolStruct()
46        {
47                return gParamSpecPool;
48        }
49
50        /** the main Gtk struct as a void* */
51        protected void* getStruct()
52        {
53                return cast(void*)gParamSpecPool;
54        }
55
56        /**
57         * Sets our main struct and passes it to the parent class.
58         */
59        public this (GParamSpecPool* gParamSpecPool, bool ownedRef = false)
60        {
61                this.gParamSpecPool = gParamSpecPool;
62                this.ownedRef = ownedRef;
63        }
64
65
66        /**
67         * Inserts a #GParamSpec in the pool.
68         *
69         * Params:
70         *     pspec = the #GParamSpec to insert
71         *     ownerType = a #GType identifying the owner of @pspec
72         */
73        public void insert(ParamSpec pspec, GType ownerType)
74        {
75                g_param_spec_pool_insert(gParamSpecPool, (pspec is null) ? null : pspec.getParamSpecStruct(), ownerType);
76        }
77
78        /**
79         * Gets an array of all #GParamSpecs owned by @owner_type in
80         * the pool.
81         *
82         * Params:
83         *     ownerType = the owner to look for
84         *
85         * Returns: a newly
86         *     allocated array containing pointers to all #GParamSpecs
87         *     owned by @owner_type in the pool
88         */
89        public ParamSpec[] list(GType ownerType)
90        {
91                uint nPspecsP;
92               
93                auto p = g_param_spec_pool_list(gParamSpecPool, ownerType, &nPspecsP);
94               
95                if(p is null)
96                {
97                        return null;
98                }
99               
100                ParamSpec[] arr = new ParamSpec[nPspecsP];
101                for(int i = 0; i < nPspecsP; i++)
102                {
103                        arr[i] = ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p[i]);
104                }
105               
106                return arr;
107        }
108
109        /**
110         * Gets an #GList of all #GParamSpecs owned by @owner_type in
111         * the pool.
112         *
113         * Params:
114         *     ownerType = the owner to look for
115         *
116         * Returns: a
117         *     #GList of all #GParamSpecs owned by @owner_type in
118         *     the pool#GParamSpecs.
119         */
120        public ListG listOwned(GType ownerType)
121        {
122                auto p = g_param_spec_pool_list_owned(gParamSpecPool, ownerType);
123               
124                if(p is null)
125                {
126                        return null;
127                }
128               
129                return new ListG(cast(GList*) p);
130        }
131
132        /**
133         * Looks up a #GParamSpec in the pool.
134         *
135         * Params:
136         *     paramName = the name to look for
137         *     ownerType = the owner to look for
138         *     walkAncestors = If %TRUE, also try to find a #GParamSpec with @param_name
139         *         owned by an ancestor of @owner_type.
140         *
141         * Returns: The found #GParamSpec, or %NULL if no
142         *     matching #GParamSpec was found.
143         */
144        public ParamSpec lookup(string paramName, GType ownerType, bool walkAncestors)
145        {
146                auto p = g_param_spec_pool_lookup(gParamSpecPool, Str.toStringz(paramName), ownerType, walkAncestors);
147               
148                if(p is null)
149                {
150                        return null;
151                }
152               
153                return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) p);
154        }
155
156        /**
157         * Removes a #GParamSpec from the pool.
158         *
159         * Params:
160         *     pspec = the #GParamSpec to remove
161         */
162        public void remove(ParamSpec pspec)
163        {
164                g_param_spec_pool_remove(gParamSpecPool, (pspec is null) ? null : pspec.getParamSpecStruct());
165        }
166
167        /**
168         * Creates a new #GParamSpecPool.
169         *
170         * If @type_prefixing is %TRUE, lookups in the newly created pool will
171         * allow to specify the owner as a colon-separated prefix of the
172         * property name, like "GtkContainer:border-width". This feature is
173         * deprecated, so you should always set @type_prefixing to %FALSE.
174         *
175         * Params:
176         *     typePrefixing = Whether the pool will support type-prefixed property names.
177         *
178         * Returns: a newly allocated #GParamSpecPool.
179         *
180         * Throws: ConstructionException GTK+ fails to create the object.
181         */
182        public this(bool typePrefixing)
183        {
184                auto p = g_param_spec_pool_new(typePrefixing);
185               
186                if(p is null)
187                {
188                        throw new ConstructionException("null returned by new");
189                }
190               
191                this(cast(GParamSpecPool*) p);
192        }
193}
Note: See TracBrowser for help on using the repository browser.