alternative to assert
[gtkD.git] / src / glib / Tuples.d
blob73e422e35d3a7a19527f854b30e112af43f92499
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 * local aliases:
48 module glib.Tuples;
50 private import glib.glibtypes;
52 private import lib.glib;
55 /**
56 * Description
57 * A GRelation is a table of data which can be indexed on any number of fields,
58 * rather like simple database tables. A GRelation contains a number of
59 * records, called tuples. Each record contains a number of fields.
60 * Records are not ordered, so it is not possible to find the record at a
61 * particular index.
62 * Note that GRelation tables are currently limited to 2 fields.
63 * To create a GRelation, use g_relation_new().
64 * To specify which fields should be indexed, use g_relation_index().
65 * Note that this must be called before any tuples are added to the GRelation.
66 * To add records to a GRelation use g_relation_insert().
67 * To determine if a given record appears in a GRelation, use
68 * g_relation_exists(). Note that fields are compared directly, so pointers
69 * must point to the exact same position (i.e. different copies of the same
70 * string will not match.)
71 * To count the number of records which have a particular value in a given
72 * field, use g_relation_count().
73 * To get all the records which have a particular value in a given field,
74 * use g_relation_select(). To access fields of the resulting records,
75 * use g_tuples_index(). To free the resulting records use g_tuples_destroy().
76 * To delete all records which have a particular value in a given field,
77 * use g_relation_delete().
78 * To destroy the GRelation, use g_relation_destroy().
79 * To help debug GRelation objects, use g_relation_print().
81 public class Tuples
84 /** the main Gtk struct */
85 protected GTuples* gTuples;
88 public GTuples* getTuplesStruct()
90 return gTuples;
94 /** the main Gtk struct as a void* */
95 protected void* getStruct()
97 return cast(void*)gTuples;
101 * Sets our main struct and passes it to the parent class
103 public this (GTuples* gTuples)
105 this.gTuples = gTuples;
123 * Frees the records which were returned by g_relation_select().
124 * This should always be called after g_relation_select() when you are
125 * finished with the records.
126 * The records are not removed from the GRelation.
127 * tuples:
128 * the tuple data to free.
130 public void destroy()
132 // void g_tuples_destroy (GTuples *tuples);
133 g_tuples_destroy(gTuples);
137 * Gets a field from the records returned by g_relation_select().
138 * It returns the given field of the record at the given index.
139 * The returned value should not be changed.
140 * tuples:
141 * the tuple data, returned by g_relation_select().
142 * index_:
143 * the index of the record.
144 * field:
145 * the field to return.
146 * Returns:
147 * the field of the record.
149 public void* index(int index, int field)
151 // gpointer g_tuples_index (GTuples *tuples, gint index_, gint field);
152 return g_tuples_index(gTuples, index, field);