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 = 27 * outPack = glib 28 * outFile = Tuples 29 * strct = GTuples 30 * realStrct= 31 * ctorStrct= 32 * clss = Tuples 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_tuples_ 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.Tuples; 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 * A GRelation is a table of data which can be indexed on any number 66 * of fields, rather like simple database tables. A GRelation contains 67 * a number of records, called tuples. Each record contains a number of 68 * fields. Records are not ordered, so it is not possible to find the 69 * record at a particular index. 70 * 71 * Note that GRelation tables are currently limited to 2 fields. 72 * 73 * To create a GRelation, use g_relation_new(). 74 * 75 * To specify which fields should be indexed, use g_relation_index(). 76 * Note that this must be called before any tuples are added to the 77 * GRelation. 78 * 79 * To add records to a GRelation use g_relation_insert(). 80 * 81 * To determine if a given record appears in a GRelation, use 82 * g_relation_exists(). Note that fields are compared directly, so 83 * pointers must point to the exact same position (i.e. different 84 * copies of the same string will not match.) 85 * 86 * To count the number of records which have a particular value in a 87 * given field, use g_relation_count(). 88 * 89 * To get all the records which have a particular value in a given 90 * field, use g_relation_select(). To access fields of the resulting 91 * records, use g_tuples_index(). To free the resulting records use 92 * g_tuples_destroy(). 93 * 94 * To delete all records which have a particular value in a given 95 * field, use g_relation_delete(). 96 * 97 * To destroy the GRelation, use g_relation_destroy(). 98 * 99 * To help debug GRelation objects, use g_relation_print(). 100 * 101 * GRelation has been marked as deprecated, since this API has never 102 * been fully implemented, is not very actively maintained and rarely 103 * used. 104 */ 105 public class Tuples 106 { 107 108 /** the main Gtk struct */ 109 protected GTuples* gTuples; 110 111 112 public GTuples* getTuplesStruct() 113 { 114 return gTuples; 115 } 116 117 118 /** the main Gtk struct as a void* */ 119 protected void* getStruct() 120 { 121 return cast(void*)gTuples; 122 } 123 124 /** 125 * Sets our main struct and passes it to the parent class 126 */ 127 public this (GTuples* gTuples) 128 { 129 this.gTuples = gTuples; 130 } 131 132 /** 133 */ 134 135 /** 136 * Warning 137 * g_tuples_destroy has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API 138 * Frees the records which were returned by g_relation_select(). This 139 * should always be called after g_relation_select() when you are 140 * finished with the records. The records are not removed from the 141 * GRelation. 142 */ 143 public void destroy() 144 { 145 // void g_tuples_destroy (GTuples *tuples); 146 g_tuples_destroy(gTuples); 147 } 148 149 /** 150 * Warning 151 * g_tuples_index has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API 152 * Gets a field from the records returned by g_relation_select(). It 153 * returns the given field of the record at the given index. The 154 * returned value should not be changed. 155 * Params: 156 * index = the index of the record. 157 * field = the field to return. 158 * Returns: the field of the record. 159 */ 160 public void* index(int index, int field) 161 { 162 // gpointer g_tuples_index (GTuples *tuples, gint index_, gint field); 163 return g_tuples_index(gTuples, index, field); 164 } 165 }