alternative to assert
[gtkD.git] / gtkD / src / glib / Tuples.d
blobc043d945573dc0414bf0c7a253ba9301ae58c13e
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile =
26 * outPack = glib
27 * outFile = Tuples
28 * strct = GTuples
29 * realStrct=
30 * ctorStrct=
31 * clss = Tuples
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_tuples_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * structWrap:
45 * module aliases:
46 * local aliases:
49 module glib.Tuples;
51 version(noAssert)
53 version(Tango)
55 import tango.io.Stdout; // use the tango loging?
59 private import gtkc.glibtypes;
61 private import gtkc.glib;
68 /**
69 * Description
70 * A GRelation is a table of data which can be indexed on any number of fields,
71 * rather like simple database tables. A GRelation contains a number of
72 * records, called tuples. Each record contains a number of fields.
73 * Records are not ordered, so it is not possible to find the record at a
74 * particular index.
75 * Note that GRelation tables are currently limited to 2 fields.
76 * To create a GRelation, use g_relation_new().
77 * To specify which fields should be indexed, use g_relation_index().
78 * Note that this must be called before any tuples are added to the GRelation.
79 * To add records to a GRelation use g_relation_insert().
80 * To determine if a given record appears in a GRelation, use
81 * g_relation_exists(). Note that fields are compared directly, so pointers
82 * must point to the exact same position (i.e. different copies of the same
83 * string will not match.)
84 * To count the number of records which have a particular value in a given
85 * field, use g_relation_count().
86 * To get all the records which have a particular value in a given field,
87 * use g_relation_select(). To access fields of the resulting records,
88 * use g_tuples_index(). To free the resulting records use g_tuples_destroy().
89 * To delete all records which have a particular value in a given field,
90 * use g_relation_delete().
91 * To destroy the GRelation, use g_relation_destroy().
92 * To help debug GRelation objects, use g_relation_print().
94 public class Tuples
97 /** the main Gtk struct */
98 protected GTuples* gTuples;
101 public GTuples* getTuplesStruct()
103 return gTuples;
107 /** the main Gtk struct as a void* */
108 protected void* getStruct()
110 return cast(void*)gTuples;
114 * Sets our main struct and passes it to the parent class
116 public this (GTuples* gTuples)
118 version(noAssert)
120 if ( gTuples is null )
122 int zero = 0;
123 version(Tango)
125 Stdout("struct gTuples is null on constructor").newline;
127 else
129 printf("struct gTuples is null on constructor");
131 zero = zero / zero;
134 else
136 assert(gTuples !is null, "struct gTuples is null on constructor");
138 this.gTuples = gTuples;
156 * Frees the records which were returned by g_relation_select().
157 * This should always be called after g_relation_select() when you are
158 * finished with the records.
159 * The records are not removed from the GRelation.
160 * tuples:
161 * the tuple data to free.
163 public void destroy()
165 // void g_tuples_destroy (GTuples *tuples);
166 g_tuples_destroy(gTuples);
170 * Gets a field from the records returned by g_relation_select().
171 * It returns the given field of the record at the given index.
172 * The returned value should not be changed.
173 * tuples:
174 * the tuple data, returned by g_relation_select().
175 * index_:
176 * the index of the record.
177 * field:
178 * the field to return.
179 * Returns:
180 * the field of the record.
182 public void* index(int index, int field)
184 // gpointer g_tuples_index (GTuples *tuples, gint index_, gint field);
185 return g_tuples_index(gTuples, index, field);