alternative to assert
[gtkD.git] / gtkD / srcgda / gda / FieldAttributes.d
blob3308f05785f70bfc07109a3d851c9ed5a83de17f
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-field.html
26 * outPack = gda
27 * outFile = FieldAttributes
28 * strct = GdaFieldAttributes
29 * realStrct=
30 * ctorStrct=
31 * clss = FieldAttributes
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gda_field_attributes_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.ListG
45 * - gda.Value
46 * structWrap:
47 * - GList* -> ListG
48 * - GdaConnection* -> Connection
49 * - GdaFieldAttributes* -> FieldAttributes
50 * - GdaValue* -> Value
51 * module aliases:
52 * local aliases:
55 module gda.FieldAttributes;
57 version(noAssert)
59 version(Tango)
61 import tango.io.Stdout; // use the tango loging?
65 private import gdac.gdatypes;
67 private import gdac.gda;
70 private import glib.ListG;
71 private import gda.Value;
76 /**
77 * Description
79 public class FieldAttributes
82 /** the main Gtk struct */
83 protected GdaFieldAttributes* gdaFieldAttributes;
86 public GdaFieldAttributes* getFieldAttributesStruct()
88 return gdaFieldAttributes;
92 /** the main Gtk struct as a void* */
93 protected void* getStruct()
95 return cast(void*)gdaFieldAttributes;
98 /**
99 * Sets our main struct and passes it to the parent class
101 public this (GdaFieldAttributes* gdaFieldAttributes)
103 version(noAssert)
105 if ( gdaFieldAttributes is null )
107 int zero = 0;
108 version(Tango)
110 Stdout("struct gdaFieldAttributes is null on constructor").newline;
112 else
114 printf("struct gdaFieldAttributes is null on constructor");
116 zero = zero / zero;
119 else
121 assert(gdaFieldAttributes !is null, "struct gdaFieldAttributes is null on constructor");
123 this.gdaFieldAttributes = gdaFieldAttributes;
133 * Returns :
135 public static GType getType()
137 // GType gda_field_attributes_get_type (void);
138 return gda_field_attributes_get_type();
142 * Returns :
143 * a newly allocated GdaFieldAttributes object.
145 public this ()
147 // GdaFieldAttributes* gda_field_attributes_new (void);
148 this(cast(GdaFieldAttributes*)gda_field_attributes_new() );
152 * Creates a new GdaFieldAttributes object from an existing one.
153 * fa :
154 * attributes to get a copy from.
155 * Returns :
156 * a newly allocated GdaFieldAttributes with a copy of the data
157 * in fa.
159 public FieldAttributes copy()
161 // GdaFieldAttributes* gda_field_attributes_copy (GdaFieldAttributes *fa);
162 return new FieldAttributes( gda_field_attributes_copy(gdaFieldAttributes) );
166 * Deallocates all memory associated to the given GdaFieldAttributes object.
167 * fa :
168 * the resource to free.
170 public void free()
172 // void gda_field_attributes_free (GdaFieldAttributes *fa);
173 gda_field_attributes_free(gdaFieldAttributes);
177 * Tests whether two field attributes are equal.
178 * lhs :
179 * a GdaFieldAttributes
180 * rhs :
181 * another GdaFieldAttributes
182 * Returns :
183 * TRUE if the field attributes contain the same information.
185 public int equal(FieldAttributes rhs)
187 // gboolean gda_field_attributes_equal (const GdaFieldAttributes *lhs, const GdaFieldAttributes *rhs);
188 return gda_field_attributes_equal(gdaFieldAttributes, (rhs is null) ? null : rhs.getFieldAttributesStruct());
192 * fa :
193 * a GdaFieldAttributes.
194 * Returns :
195 * the defined size of fa.
197 public int getDefinedSize()
199 // glong gda_field_attributes_get_defined_size (GdaFieldAttributes *fa);
200 return gda_field_attributes_get_defined_size(gdaFieldAttributes);
204 * Sets the defined size of a GdaFieldAttributes.
205 * fa :
206 * a GdaFieldAttributes.
207 * size :
208 * the defined size we want to set.
210 public void setDefinedSize(int size)
212 // void gda_field_attributes_set_defined_size (GdaFieldAttributes *fa, glong size);
213 gda_field_attributes_set_defined_size(gdaFieldAttributes, size);
217 * fa :
218 * a GdaFieldAttributes.
219 * Returns :
220 * the name of fa.
222 public char[] getName()
224 // const gchar* gda_field_attributes_get_name (GdaFieldAttributes *fa);
225 return Str.toString(gda_field_attributes_get_name(gdaFieldAttributes) );
229 * Sets the name of fa to name.
230 * fa :
231 * a GdaFieldAttributes.
232 * name :
233 * the new name of fa.
235 public void setName(char[] name)
237 // void gda_field_attributes_set_name (GdaFieldAttributes *fa, const gchar *name);
238 gda_field_attributes_set_name(gdaFieldAttributes, Str.toStringz(name));
242 * fa :
243 * a GdaFieldAttributes.
244 * Returns :
245 * the name of the table to which this field belongs.
247 public char[] getTable()
249 // const gchar* gda_field_attributes_get_table (GdaFieldAttributes *fa);
250 return Str.toString(gda_field_attributes_get_table(gdaFieldAttributes) );
254 * Sets the name of the table to which the given field belongs.
255 * fa :
256 * a GdaFieldAttributes.
257 * table :
258 * table name.
260 public void setTable(char[] table)
262 // void gda_field_attributes_set_table (GdaFieldAttributes *fa, const gchar *table);
263 gda_field_attributes_set_table(gdaFieldAttributes, Str.toStringz(table));
267 * fa :
268 * a GdaFieldAttributes.
269 * Returns :
270 * fa's caption.
272 public char[] getCaption()
274 // const gchar* gda_field_attributes_get_caption (GdaFieldAttributes *fa);
275 return Str.toString(gda_field_attributes_get_caption(gdaFieldAttributes) );
279 * Sets fa's caption.
280 * fa :
281 * a GdaFieldAttributes.
282 * caption :
283 * caption.
285 public void setCaption(char[] caption)
287 // void gda_field_attributes_set_caption (GdaFieldAttributes *fa, const gchar *caption);
288 gda_field_attributes_set_caption(gdaFieldAttributes, Str.toStringz(caption));
292 * fa :
293 * a GdaFieldAttributes.
294 * Returns :
295 * the number of decimals of fa.
297 public int getScale()
299 // glong gda_field_attributes_get_scale (GdaFieldAttributes *fa);
300 return gda_field_attributes_get_scale(gdaFieldAttributes);
304 * Sets the scale of fa to scale.
305 * fa :
306 * a GdaFieldAttributes.
307 * scale :
308 * number of decimals.
310 public void setScale(int scale)
312 // void gda_field_attributes_set_scale (GdaFieldAttributes *fa, glong scale);
313 gda_field_attributes_set_scale(gdaFieldAttributes, scale);
317 * fa :
318 * a GdaFieldAttributes.
319 * Returns :
320 * the type of fa.
322 public GdaValueType getGdatype()
324 // GdaValueType gda_field_attributes_get_gdatype (GdaFieldAttributes *fa);
325 return gda_field_attributes_get_gdatype(gdaFieldAttributes);
329 * Sets the type of fa to type.
330 * fa :
331 * a GdaFieldAttributes.
332 * type :
333 * the new type of fa.
335 public void setGdatype(GdaValueType type)
337 // void gda_field_attributes_set_gdatype (GdaFieldAttributes *fa, GdaValueType type);
338 gda_field_attributes_set_gdatype(gdaFieldAttributes, type);
342 * Gets the 'allow null' flag of the given field attributes.
343 * fa :
344 * a GdaFieldAttributes.
345 * Returns :
346 * whether the given field allows null values or not (TRUE or FALSE).
348 public int getAllowNull()
350 // gboolean gda_field_attributes_get_allow_null (GdaFieldAttributes *fa);
351 return gda_field_attributes_get_allow_null(gdaFieldAttributes);
355 * Sets the 'allow null' flag of the given field attributes.
356 * fa :
357 * a GdaFieldAttributes.
358 * allow :
359 * whether the given field should allows null values or not.
361 public void setAllowNull(int allow)
363 // void gda_field_attributes_set_allow_null (GdaFieldAttributes *fa, gboolean allow);
364 gda_field_attributes_set_allow_null(gdaFieldAttributes, allow);
368 * fa :
369 * a GdaFieldAttributes.
370 * Returns :
371 * whether if the given field is a primary key (TRUE or FALSE).
373 public int getPrimaryKey()
375 // gboolean gda_field_attributes_get_primary_key (GdaFieldAttributes *fa);
376 return gda_field_attributes_get_primary_key(gdaFieldAttributes);
380 * Sets the 'primary key' flag of the given field attributes.
381 * fa :
382 * a GdaFieldAttributes.
383 * pk :
384 * whether if the given field should be a primary key.
386 public void setPrimaryKey(int pk)
388 // void gda_field_attributes_set_primary_key (GdaFieldAttributes *fa, gboolean pk);
389 gda_field_attributes_set_primary_key(gdaFieldAttributes, pk);
393 * fa :
394 * a GdaFieldAttributes.
395 * Returns :
396 * whether if the given field is an unique key (TRUE or FALSE).
398 public int getUniqueKey()
400 // gboolean gda_field_attributes_get_unique_key (GdaFieldAttributes *fa);
401 return gda_field_attributes_get_unique_key(gdaFieldAttributes);
405 * Sets the 'unique key' flag of the given field attributes.
406 * fa :
407 * a GdaFieldAttributes.
408 * uk :
409 * whether if the given field should be an unique key.
411 public void setUniqueKey(int uk)
413 // void gda_field_attributes_set_unique_key (GdaFieldAttributes *fa, gboolean uk);
414 gda_field_attributes_set_unique_key(gdaFieldAttributes, uk);
418 * fa :
419 * a GdaFieldAttributes.
420 * Returns :
421 * fa's references.
423 public char[] getReferences()
425 // const gchar* gda_field_attributes_get_references (GdaFieldAttributes *fa);
426 return Str.toString(gda_field_attributes_get_references(gdaFieldAttributes) );
430 * Sets fa's references.
431 * fa :
432 * a GdaFieldAttributes.
433 * ref :
434 * references.
436 public void setReferences(char[] doref)
438 // void gda_field_attributes_set_references (GdaFieldAttributes *fa, const gchar *ref);
439 gda_field_attributes_set_references(gdaFieldAttributes, Str.toStringz(doref));
443 * fa :
444 * a GdaFieldAttributes.
445 * Returns :
446 * whether the given field is an auto incremented one (TRUE or FALSE).
448 public int getAutoIncrement()
450 // gboolean gda_field_attributes_get_auto_increment (GdaFieldAttributes *fa);
451 return gda_field_attributes_get_auto_increment(gdaFieldAttributes);
455 * Sets the auto increment flag for the given field.
456 * fa :
457 * a GdaFieldAttributes.
458 * is_auto :
459 * auto increment status.
461 public void setAutoIncrement(int isAuto)
463 // void gda_field_attributes_set_auto_increment (GdaFieldAttributes *fa, gboolean is_auto);
464 gda_field_attributes_set_auto_increment(gdaFieldAttributes, isAuto);
468 * fa :
469 * a GdaFieldAttributes.
470 * Returns :
471 * the position of the field the attributes refer to in the
472 * containing data model.
474 public int getPosition()
476 // gint gda_field_attributes_get_position (GdaFieldAttributes *fa);
477 return gda_field_attributes_get_position(gdaFieldAttributes);
481 * Sets the position of the field the attributes refer to in the containing
482 * data model.
483 * fa :
484 * a GdaFieldAttributes.
485 * position :
486 * the wanted position of the field in the containing data model.
488 public void setPosition(int position)
490 // void gda_field_attributes_set_position (GdaFieldAttributes *fa, gint position);
491 gda_field_attributes_set_position(gdaFieldAttributes, position);
495 * fa :
496 * a GdaFieldAttributes.
497 * Returns :
498 * fa's default value, as a GdaValue object.
500 public Value getDefaultValue()
502 // const GdaValue* gda_field_attributes_get_default_value (GdaFieldAttributes *fa);
503 return new Value( gda_field_attributes_get_default_value(gdaFieldAttributes) );
507 * Sets fa's default GdaValue.
508 * fa :
509 * a GdaFieldAttributes.
510 * default_value :
511 * default GdaValue for the field
513 public void setDefaultValue(Value defaultValue)
515 // void gda_field_attributes_set_default_value (GdaFieldAttributes *fa, const GdaValue *default_value);
516 gda_field_attributes_set_default_value(gdaFieldAttributes, (defaultValue is null) ? null : defaultValue.getValueStruct());