alternative to assert
[gtkD.git] / gtkD / srcgda / gda / Row.d
blob6a8f9089a411b48b6cb6b832e2d8fb393e7b0e05
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 = libgda-gda-row.html
26 * outPack = gda
27 * outFile = Row
28 * strct = GdaRow
29 * realStrct=
30 * ctorStrct=
31 * clss = Row
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gda_row_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gda.Value
45 * - gda.DataModel
46 * structWrap:
47 * - GdaDataModel* -> DataModel
48 * - GdaRow* -> Row
49 * - GdaValue* -> Value
50 * module aliases:
51 * local aliases:
54 module gda.Row;
56 version(noAssert)
58 version(Tango)
60 import tango.io.Stdout; // use the tango loging?
64 private import gdac.gdatypes;
66 private import gdac.gda;
69 private import gda.Value;
70 private import gda.DataModel;
75 /**
76 * Description
78 public class Row
81 /** the main Gtk struct */
82 protected GdaRow* gdaRow;
85 public GdaRow* getRowStruct()
87 return gdaRow;
91 /** the main Gtk struct as a void* */
92 protected void* getStruct()
94 return cast(void*)gdaRow;
97 /**
98 * Sets our main struct and passes it to the parent class
100 public this (GdaRow* gdaRow)
102 version(noAssert)
104 if ( gdaRow is null )
106 int zero = 0;
107 version(Tango)
109 Stdout("struct gdaRow is null on constructor").newline;
111 else
113 printf("struct gdaRow is null on constructor");
115 zero = zero / zero;
118 else
120 assert(gdaRow !is null, "struct gdaRow is null on constructor");
122 this.gdaRow = gdaRow;
132 * Returns :
134 public static GType getType()
136 // GType gda_row_get_type (void);
137 return gda_row_get_type();
141 * Creates a GdaRow which can hold count GdaValue.
142 * model :
143 * the GdaDataModel this row belongs to.
144 * count :
145 * number of GdaValue in the new GdaRow.
146 * Returns :
147 * the newly allocated GdaRow.
149 public this (DataModel model, int count)
151 // GdaRow* gda_row_new (GdaDataModel *model, gint count);
152 this(cast(GdaRow*)gda_row_new((model is null) ? null : model.getDataModelStruct(), count) );
156 * Creates a GdaRow from a list of GdaValue's. These GdaValue's are
157 * value-copied and the user are still resposible for freeing them.
158 * model :
159 * a GdaDataModel.
160 * values :
161 * a list of GdaValue's.
162 * Returns :
163 * the newly created row.
165 public this (DataModel model, GList* values)
167 // GdaRow* gda_row_new_from_list (GdaDataModel *model, const GList *values);
168 this(cast(GdaRow*)gda_row_new_from_list((model is null) ? null : model.getDataModelStruct(), values) );
172 * Creates a new GdaRow from an existing one.
173 * row :
174 * quark_list to get a copy from.
175 * Returns :
176 * a newly allocated GdaRow with a copy of the data in row.
178 public Row copy()
180 // GdaRow* gda_row_copy (GdaRow *row);
181 return new Row( gda_row_copy(gdaRow) );
185 * Deallocates all memory associated to a GdaRow.
186 * row :
187 * the resource to free.
189 public void free()
191 // void gda_row_free (GdaRow *row);
192 gda_row_free(gdaRow);
196 * Gets the GdaDataModel the given GdaRow belongs to.
197 * row :
198 * a GdaRow.
199 * Returns :
200 * a GdaDataModel.
202 public DataModel getModel()
204 // GdaDataModel* gda_row_get_model (GdaRow *row);
205 return new DataModel( gda_row_get_model(gdaRow) );
209 * Gets the number of the given row, that is, its position in its containing
210 * data model.
211 * row :
212 * a GdaRow.
213 * Returns :
214 * the row number, or -1 if there was an error.
216 public int getNumber()
218 // gint gda_row_get_number (GdaRow *row);
219 return gda_row_get_number(gdaRow);
223 * Sets the row number for the given row.
224 * row :
225 * a GdaRow.
226 * number :
227 * the new row number.
229 public void setNumber(int number)
231 // void gda_row_set_number (GdaRow *row, gint number);
232 gda_row_set_number(gdaRow, number);
236 * Returns the unique identifier for this row. This identifier is
237 * assigned by the different providers, to uniquely identify
238 * rows returned to clients. If there is no ID, this means that
239 * the row has not been created by a provider, or that it the
240 * provider cannot identify it (ie, modifications to it won't
241 * take place into the database).
242 * row :
243 * a GdaRow (which contains GdaValue).
244 * Returns :
245 * the unique identifier for this row.
247 public char[] getId()
249 // const gchar* gda_row_get_id (GdaRow *row);
250 return Str.toString(gda_row_get_id(gdaRow) );
254 * Assigns a new identifier to the given row. This function is
255 * usually called by providers.
256 * row :
257 * a GdaRow (which contains GdaValue).
258 * id :
259 * new identifier for the row.
261 public void setId(char[] id)
263 // void gda_row_set_id (GdaRow *row, const gchar *id);
264 gda_row_set_id(gdaRow, Str.toStringz(id));
268 * Gets a pointer to a GdaValue stored in a GdaRow.
269 * This is a pointer to the internal array of values. Don't try to free
270 * or modify it!
271 * row :
272 * a GdaRow (which contains GdaValue).
273 * num :
274 * field index.
275 * Returns :
276 * a pointer to the GdaValue in the position num of row.
278 public Value getValue(int num)
280 // GdaValue* gda_row_get_value (GdaRow *row, gint num);
281 return new Value( gda_row_get_value(gdaRow, num) );
285 * row :
286 * a GdaRow.
287 * Returns :
288 * the number of columns that the row has.
290 public int getLength()
292 // gint gda_row_get_length (GdaRow *row);
293 return gda_row_get_length(gdaRow);