alternative to assert
[gtkD.git] / gtkD / srcgda / gda / Table.d
blob5169ce998bb87642950e7263d8714c348ea30d99
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-GdaTable.html
26 * outPack = gda
27 * outFile = Table
28 * strct = GdaTable
29 * realStrct=
30 * ctorStrct=
31 * clss = Table
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gda_table_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gda.DataModel
45 * - gda.FieldAttributes
46 * structWrap:
47 * - GdaDataModel* -> DataModel
48 * - GdaFieldAttributes* -> FieldAttributes
49 * - GdaTable* -> Table
50 * module aliases:
51 * local aliases:
54 module gda.Table;
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.DataModel;
70 private import gda.FieldAttributes;
75 /**
76 * Description
78 public class Table
81 /** the main Gtk struct */
82 protected GdaTable* gdaTable;
85 public GdaTable* getTableStruct()
87 return gdaTable;
91 /** the main Gtk struct as a void* */
92 protected void* getStruct()
94 return cast(void*)gdaTable;
97 /**
98 * Sets our main struct and passes it to the parent class
100 public this (GdaTable* gdaTable)
102 version(noAssert)
104 if ( gdaTable is null )
106 int zero = 0;
107 version(Tango)
109 Stdout("struct gdaTable is null on constructor").newline;
111 else
113 printf("struct gdaTable is null on constructor");
115 zero = zero / zero;
118 else
120 assert(gdaTable !is null, "struct gdaTable is null on constructor");
122 this.gdaTable = gdaTable;
130 * Creates a new GdaTable object, which is an in-memory representation
131 * of an entire table. It is mainly used by the GdaXmlDatabase class,
132 * but you can also use it in your applications for whatever you may need
133 * it.
134 * name :
135 * name for the new table.
136 * Returns :
137 * the newly created object.
139 public this (char[] name)
141 // GdaTable* gda_table_new (const gchar *name);
142 this(cast(GdaTable*)gda_table_new(Str.toStringz(name)) );
146 * Creates a GdaTable object from the given GdaDataModel. This
147 * is very useful to maintain an in-memory copy of a given
148 * recordset obtained from a database. This is also used when
149 * exporting data to a GdaXmlDatabase object.
150 * name :
151 * name for the new table.
152 * model :
153 * model to create the table from.
154 * add_data :
155 * whether to add model's data or not.
156 * Returns :
157 * the newly created object.
159 public this (char[] name, DataModel model, int addData)
161 // GdaTable* gda_table_new_from_model (const gchar *name, const GdaDataModel *model, gboolean add_data);
162 this(cast(GdaTable*)gda_table_new_from_model(Str.toStringz(name), (model is null) ? null : model.getDataModelStruct(), addData) );
166 * table :
167 * a GdaTable object.
168 * Returns :
169 * the name of the given GdaTable.
171 public char[] getName()
173 // const gchar* gda_table_get_name (GdaTable *table);
174 return Str.toString(gda_table_get_name(gdaTable) );
178 * Sets the name of the given GdaTable.
179 * table :
180 * a GdaTable object.
181 * name :
182 * new name for the table.
184 public void setName(char[] name)
186 // void gda_table_set_name (GdaTable *table, const gchar *name);
187 gda_table_set_name(gdaTable, Str.toStringz(name));
191 * Adds a field to the given GdaTable.
192 * table :
193 * a GdaTable object.
194 * fa :
195 * attributes for the new field.
197 public void addField(FieldAttributes fa)
199 // void gda_table_add_field (GdaTable *table, const GdaFieldAttributes *fa);
200 gda_table_add_field(gdaTable, (fa is null) ? null : fa.getFieldAttributesStruct());
204 * Adds data in the given table from the given model.
205 * table :
206 * a GdaTable object.
207 * model :
208 * a GdaDataModel object.
210 public void addDataFromModel(DataModel model)
212 // void gda_table_add_data_from_model (GdaTable *table, const GdaDataModel *model);
213 gda_table_add_data_from_model(gdaTable, (model is null) ? null : model.getDataModelStruct());