1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = glib-Datasets.html
27  * outPack = glib
28  * outFile = Dataset
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Dataset
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_dataset_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module glib.Dataset;
53 
54 public  import gtkc.glibtypes;
55 
56 private import gtkc.glib;
57 private import glib.ConstructionException;
58 
59 
60 
61 
62 
63 
64 /**
65  * Datasets associate groups of data elements with particular memory
66  * locations. These are useful if you need to associate data with a
67  * structure returned from an external library. Since you cannot modify
68  * the structure, you use its location in memory as the key into a
69  * dataset, where you can associate any number of data elements with it.
70  *
71  * There are two forms of most of the dataset functions. The first form
72  * uses strings to identify the data elements associated with a
73  * location. The second form uses GQuark identifiers, which are
74  * created with a call to g_quark_from_string() or
75  * g_quark_from_static_string(). The second form is quicker, since it
76  * does not require looking up the string in the hash table of GQuark
77  * identifiers.
78  *
79  * There is no function to create a dataset. It is automatically
80  * created as soon as you add elements to it.
81  *
82  * To add data elements to a dataset use g_dataset_id_set_data(),
83  * g_dataset_id_set_data_full(), g_dataset_set_data() and
84  * g_dataset_set_data_full().
85  *
86  * To get data elements from a dataset use g_dataset_id_get_data() and
87  * g_dataset_get_data().
88  *
89  * To iterate over all data elements in a dataset use
90  * g_dataset_foreach() (not thread-safe).
91  *
92  * To remove data elements from a dataset use
93  * g_dataset_id_remove_data() and g_dataset_remove_data().
94  *
95  * To destroy a dataset, use g_dataset_destroy().
96  */
97 public class Dataset
98 {
99 	
100 	/**
101 	 */
102 	
103 	/**
104 	 * Sets the data element associated with the given GQuark id, and also
105 	 * the function to call when the data element is destroyed. Any
106 	 * previous data with the same key is removed, and its destroy function
107 	 * is called.
108 	 * Params:
109 	 * datasetLocation = the location identifying the dataset.
110 	 * keyId = the GQuark id to identify the data element.
111 	 * data = the data element.
112 	 * destroyFunc = the function to call when the data element is
113 	 * removed. This function will be called with the data
114 	 * element and can be used to free any memory allocated
115 	 * for it.
116 	 */
117 	public static void idSetDataFull(void* datasetLocation, GQuark keyId, void* data, GDestroyNotify destroyFunc)
118 	{
119 		// void g_dataset_id_set_data_full (gconstpointer dataset_location,  GQuark key_id,  gpointer data,  GDestroyNotify destroy_func);
120 		g_dataset_id_set_data_full(datasetLocation, keyId, data, destroyFunc);
121 	}
122 	
123 	/**
124 	 * Gets the data element corresponding to a GQuark.
125 	 * Params:
126 	 * datasetLocation = the location identifying the dataset.
127 	 * keyId = the GQuark id to identify the data element.
128 	 * Returns: the data element corresponding to the GQuark, or NULL if it is not found.
129 	 */
130 	public static void* idGetData(void* datasetLocation, GQuark keyId)
131 	{
132 		// gpointer g_dataset_id_get_data (gconstpointer dataset_location,  GQuark key_id);
133 		return g_dataset_id_get_data(datasetLocation, keyId);
134 	}
135 	
136 	/**
137 	 * Removes an element, without calling its destroy notification
138 	 * function.
139 	 * Params:
140 	 * datasetLocation = the location identifying the dataset.
141 	 * keyId = the GQuark ID identifying the data element.
142 	 * Returns: the data previously stored at key_id, or NULL if none.
143 	 */
144 	public static void* idRemoveNoNotify(void* datasetLocation, GQuark keyId)
145 	{
146 		// gpointer g_dataset_id_remove_no_notify (gconstpointer dataset_location,  GQuark key_id);
147 		return g_dataset_id_remove_no_notify(datasetLocation, keyId);
148 	}
149 	
150 	/**
151 	 * Calls the given function for each data element which is associated
152 	 * with the given location. Note that this function is NOT thread-safe.
153 	 * So unless datalist can be protected from any modifications during
154 	 * invocation of this function, it should not be called.
155 	 * Params:
156 	 * datasetLocation = the location identifying the dataset.
157 	 * func = the function to call for each data element.
158 	 * userData = user data to pass to the function.
159 	 */
160 	public static void foreac(void* datasetLocation, GDataForeachFunc func, void* userData)
161 	{
162 		// void g_dataset_foreach (gconstpointer dataset_location,  GDataForeachFunc func,  gpointer user_data);
163 		g_dataset_foreach(datasetLocation, func, userData);
164 	}
165 	
166 	/**
167 	 * Destroys the dataset, freeing all memory allocated, and calling any
168 	 * destroy functions set for data elements.
169 	 * Params:
170 	 * datasetLocation = the location identifying the dataset.
171 	 */
172 	public static void destroy(void* datasetLocation)
173 	{
174 		// void g_dataset_destroy (gconstpointer dataset_location);
175 		g_dataset_destroy(datasetLocation);
176 	}
177 }