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