2 * This file is part of duit.
4 * duit 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 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = glib-Caches.html
46 * - GHashTable* -> HashTable
52 private import glib
.glibtypes
;
54 private import lib
.glib
;
56 private import glib
.HashTable
;
60 * A GCache allows sharing of complex data structures, in order to save
62 * GTK+ uses caches for GtkStyles and GdkGCs. These consume a lot of
63 * resources, so a GCache is used to see if a GtkStyle or GdkGC with the
64 * required properties already exists. If it does, then the existing
65 * object is used instead of creating a new one.
66 * GCache uses keys and values.
67 * A GCache key describes the properties of a particular resource.
68 * A GCache value is the actual resource.
73 /** the main Gtk struct */
74 protected GCache
* gCache
;
77 public GCache
* getCacheStruct()
83 /** the main Gtk struct as a void* */
84 protected void* getStruct()
86 return cast(void*)gCache
;
90 * Sets our main struct and passes it to the parent class
92 public this (GCache
* gCache
)
102 * Creates a new GCache.
104 * a function to create a new object given a key.
105 * This is called by g_cache_insert() if an object with the given key
106 * does not already exist.
107 * value_destroy_func:
108 * a function to destroy an object. It is
109 * called by g_cache_remove() when the object is no longer needed (i.e. its
110 * reference count drops to 0).
112 * a function to copy a key. It is called by
113 * g_cache_insert() if the key does not already exist in the GCache.
115 * a function to destroy a key. It is
116 * called by g_cache_remove() when the object is no longer needed (i.e. its
117 * reference count drops to 0).
119 * a function to create a hash value from a key.
121 * a function to create a hash value from a value.
123 * a function to compare two keys. It should return TRUE if
124 * the two keys are equivalent.
128 public this (GCacheNewFunc valueNewFunc
, GCacheDestroyFunc valueDestroyFunc
, GCacheDupFunc keyDupFunc
, GCacheDestroyFunc keyDestroyFunc
, GHashFunc hashKeyFunc
, GHashFunc hashValueFunc
, GEqualFunc keyEqualFunc
)
130 // GCache* g_cache_new (GCacheNewFunc value_new_func, GCacheDestroyFunc value_destroy_func, GCacheDupFunc key_dup_func, GCacheDestroyFunc key_destroy_func, GHashFunc hash_key_func, GHashFunc hash_value_func, GEqualFunc key_equal_func);
131 this(cast(GCache
*)g_cache_new(valueNewFunc
, valueDestroyFunc
, keyDupFunc
, keyDestroyFunc
, hashKeyFunc
, hashValueFunc
, keyEqualFunc
) );
135 * Gets the value corresponding to the given key, creating it if necessary.
136 * It first checks if the value already exists in the GCache, by using
137 * the key_equal_func function passed to g_cache_new().
138 * If it does already exist it is returned, and its reference count is increased
140 * If the value does not currently exist, if is created by calling the
141 * value_new_func. The key is duplicated by calling
142 * key_dup_func and the duplicated key and value are inserted
147 * a key describing a GCache object.
149 * a pointer to a GCache value.
151 public void* insert(void* key
)
153 // gpointer g_cache_insert (GCache *cache, gpointer key);
154 return g_cache_insert(gCache
, key
);
158 * Decreases the reference count of the given value.
159 * If it drops to 0 then the value and its corresponding key are destroyed,
160 * using the value_destroy_func and key_destroy_func passed to g_cache_new().
164 * the value to remove.
166 public void remove(void* value
)
168 // void g_cache_remove (GCache *cache, gconstpointer value);
169 g_cache_remove(gCache
, value
);
173 * Frees the memory allocated for the GCache.
174 * Note that it does not destroy the keys and values which were contained in the
179 public void destroy()
181 // void g_cache_destroy (GCache *cache);
182 g_cache_destroy(gCache
);
186 * Calls the given function for each of the keys in the GCache.
188 * func is passed three parameters, the value and key of a
189 * cache entry and the user_data. The order of value and key is different
190 * from the order in which g_hash_table_foreach() passes key-value pairs
191 * to its callback function !
195 * the function to call with each GCache key.
197 * user data to pass to the function.
199 public void keyForeach(GHFunc func
, void* userData
)
201 // void g_cache_key_foreach (GCache *cache, GHFunc func, gpointer user_data);
202 g_cache_key_foreach(gCache
, func
, userData
);
207 * g_cache_value_foreach has been deprecated since version 2.10 and should not be used in newly-written code. The reason is that it passes pointers to internal data
208 * structures to func; use g_cache_key_foreach() instead
209 * Calls the given function for each of the values in the GCache.
213 * the function to call with each GCache value.
215 * user data to pass to the function.
217 public void valueForeach(GHFunc func
, void* userData
)
219 // void g_cache_value_foreach (GCache *cache, GHFunc func, gpointer user_data);
220 g_cache_value_foreach(gCache
, func
, userData
);