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 module glib.DataSet;
26 
27 private import glib.c.functions;
28 public  import glib.c.types;
29 public  import gtkc.glibtypes;
30 
31 
32 /** */
33 public struct DataSet
34 {
35 
36 	/**
37 	 * Destroys the dataset, freeing all memory allocated, and calling any
38 	 * destroy functions set for data elements.
39 	 *
40 	 * Params:
41 	 *     datasetLocation = the location identifying the dataset.
42 	 */
43 	public static void destroy(void* datasetLocation)
44 	{
45 		g_dataset_destroy(datasetLocation);
46 	}
47 
48 	alias foreac = foreach_;
49 	/**
50 	 * Calls the given function for each data element which is associated
51 	 * with the given location. Note that this function is NOT thread-safe.
52 	 * So unless @dataset_location can be protected from any modifications
53 	 * during invocation of this function, it should not be called.
54 	 *
55 	 * @func can make changes to the dataset, but the iteration will not
56 	 * reflect changes made during the g_dataset_foreach() call, other
57 	 * than skipping over elements that are removed.
58 	 *
59 	 * Params:
60 	 *     datasetLocation = the location identifying the dataset.
61 	 *     func = the function to call for each data element.
62 	 *     userData = user data to pass to the function.
63 	 */
64 	public static void foreach_(void* datasetLocation, GDataForeachFunc func, void* userData)
65 	{
66 		g_dataset_foreach(datasetLocation, func, userData);
67 	}
68 
69 	/**
70 	 * Gets the data element corresponding to a #GQuark.
71 	 *
72 	 * Params:
73 	 *     datasetLocation = the location identifying the dataset.
74 	 *     keyId = the #GQuark id to identify the data element.
75 	 *
76 	 * Returns: the data element corresponding to
77 	 *     the #GQuark, or %NULL if it is not found.
78 	 */
79 	public static void* idGetData(void* datasetLocation, GQuark keyId)
80 	{
81 		return g_dataset_id_get_data(datasetLocation, keyId);
82 	}
83 
84 	/**
85 	 * Removes an element, without calling its destroy notification
86 	 * function.
87 	 *
88 	 * Params:
89 	 *     datasetLocation = the location identifying the dataset.
90 	 *     keyId = the #GQuark ID identifying the data element.
91 	 *
92 	 * Returns: the data previously stored at @key_id,
93 	 *     or %NULL if none.
94 	 */
95 	public static void* idRemoveNoNotify(void* datasetLocation, GQuark keyId)
96 	{
97 		return g_dataset_id_remove_no_notify(datasetLocation, keyId);
98 	}
99 
100 	/**
101 	 * Sets the data element associated with the given #GQuark id, and also
102 	 * the function to call when the data element is destroyed. Any
103 	 * previous data with the same key is removed, and its destroy function
104 	 * is called.
105 	 *
106 	 * Params:
107 	 *     datasetLocation = the location identifying the dataset.
108 	 *     keyId = the #GQuark id to identify the data element.
109 	 *     data = the data element.
110 	 *     destroyFunc = the function to call when the data element is
111 	 *         removed. This function will be called with the data
112 	 *         element and can be used to free any memory allocated
113 	 *         for it.
114 	 */
115 	public static void idSetDataFull(void* datasetLocation, GQuark keyId, void* data, GDestroyNotify destroyFunc)
116 	{
117 		g_dataset_id_set_data_full(datasetLocation, keyId, data, destroyFunc);
118 	}
119 }