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:
55 import tango
.io
.Stdout
; // use the tango loging?
59 private import gtkc
.glibtypes
;
61 private import gtkc
.glib
;
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
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().
97 /** the main Gtk struct */
98 protected GTuples
* gTuples
;
101 public GTuples
* getTuplesStruct()
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
)
120 if ( gTuples
is null )
125 Stdout("struct gTuples is null on constructor").newline
;
129 printf("struct gTuples is null on constructor");
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.
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.
174 * the tuple data, returned by g_relation_select().
176 * the index of the record.
178 * the field to return.
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
);