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