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