1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = libgda-gda-field.html
27  * outPack = gda
28  * outFile = FieldAttributes
29  * strct   = GdaFieldAttributes
30  * realStrct=
31  * ctorStrct=
32  * clss    = FieldAttributes
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gda_field_attributes_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gda.Value
48  * structWrap:
49  * 	- GdaFieldAttributes* -> FieldAttributes
50  * 	- GdaValue* -> Value
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gda.FieldAttributes;
57 
58 public  import gdac.gdatypes;
59 
60 private import gdac.gda;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 
65 private import glib.Str;
66 private import gda.Value;
67 
68 
69 
70 
71 /**
72  */
73 public class FieldAttributes
74 {
75 	
76 	/** the main Gtk struct */
77 	protected GdaFieldAttributes* gdaFieldAttributes;
78 	
79 	
80 	public GdaFieldAttributes* getFieldAttributesStruct()
81 	{
82 		return gdaFieldAttributes;
83 	}
84 	
85 	
86 	/** the main Gtk struct as a void* */
87 	protected void* getStruct()
88 	{
89 		return cast(void*)gdaFieldAttributes;
90 	}
91 	
92 	/**
93 	 * Sets our main struct and passes it to the parent class
94 	 */
95 	public this (GdaFieldAttributes* gdaFieldAttributes)
96 	{
97 		this.gdaFieldAttributes = gdaFieldAttributes;
98 	}
99 	
100 	/**
101 	 */
102 	
103 	/**
104 	 * Returns:
105 	 */
106 	public static GType getType()
107 	{
108 		// GType gda_field_attributes_get_type (void);
109 		return gda_field_attributes_get_type();
110 	}
111 	
112 	/**
113 	 * Throws: ConstructionException GTK+ fails to create the object.
114 	 */
115 	public this ()
116 	{
117 		// GdaFieldAttributes* gda_field_attributes_new (void);
118 		auto p = gda_field_attributes_new();
119 		if(p is null)
120 		{
121 			throw new ConstructionException("null returned by gda_field_attributes_new()");
122 		}
123 		this(cast(GdaFieldAttributes*) p);
124 	}
125 	
126 	/**
127 	 * Creates a new GdaFieldAttributes object from an existing one.
128 	 * Returns: a newly allocated GdaFieldAttributes with a copy of the data in fa.
129 	 */
130 	public FieldAttributes copy()
131 	{
132 		// GdaFieldAttributes* gda_field_attributes_copy (GdaFieldAttributes *fa);
133 		auto p = gda_field_attributes_copy(gdaFieldAttributes);
134 		
135 		if(p is null)
136 		{
137 			return null;
138 		}
139 		
140 		return ObjectG.getDObject!(FieldAttributes)(cast(GdaFieldAttributes*) p);
141 	}
142 	
143 	/**
144 	 * Deallocates all memory associated to the given GdaFieldAttributes object.
145 	 */
146 	public void free()
147 	{
148 		// void gda_field_attributes_free (GdaFieldAttributes *fa);
149 		gda_field_attributes_free(gdaFieldAttributes);
150 	}
151 	
152 	/**
153 	 * Tests whether two field attributes are equal.
154 	 * Params:
155 	 * rhs = another GdaFieldAttributes
156 	 * Returns: TRUE if the field attributes contain the same information.
157 	 */
158 	public int equal(FieldAttributes rhs)
159 	{
160 		// gboolean gda_field_attributes_equal (const GdaFieldAttributes *lhs,  const GdaFieldAttributes *rhs);
161 		return gda_field_attributes_equal(gdaFieldAttributes, (rhs is null) ? null : rhs.getFieldAttributesStruct());
162 	}
163 	
164 	/**
165 	 * Returns: the defined size of fa.
166 	 */
167 	public glong getDefinedSize()
168 	{
169 		// glong gda_field_attributes_get_defined_size  (GdaFieldAttributes *fa);
170 		return gda_field_attributes_get_defined_size(gdaFieldAttributes);
171 	}
172 	
173 	/**
174 	 * Sets the defined size of a GdaFieldAttributes.
175 	 * Params:
176 	 * size = the defined size we want to set.
177 	 */
178 	public void setDefinedSize(glong size)
179 	{
180 		// void gda_field_attributes_set_defined_size  (GdaFieldAttributes *fa,  glong size);
181 		gda_field_attributes_set_defined_size(gdaFieldAttributes, size);
182 	}
183 	
184 	/**
185 	 * Returns: the name of fa.
186 	 */
187 	public string getName()
188 	{
189 		// const gchar* gda_field_attributes_get_name (GdaFieldAttributes *fa);
190 		return Str.toString(gda_field_attributes_get_name(gdaFieldAttributes));
191 	}
192 	
193 	/**
194 	 * Sets the name of fa to name.
195 	 * Params:
196 	 * name = the new name of fa.
197 	 */
198 	public void setName(string name)
199 	{
200 		// void gda_field_attributes_set_name (GdaFieldAttributes *fa,  const gchar *name);
201 		gda_field_attributes_set_name(gdaFieldAttributes, Str.toStringz(name));
202 	}
203 	
204 	/**
205 	 * Returns: the name of the table to which this field belongs.
206 	 */
207 	public string getTable()
208 	{
209 		// const gchar* gda_field_attributes_get_table (GdaFieldAttributes *fa);
210 		return Str.toString(gda_field_attributes_get_table(gdaFieldAttributes));
211 	}
212 	
213 	/**
214 	 * Sets the name of the table to which the given field belongs.
215 	 * Params:
216 	 * table = table name.
217 	 */
218 	public void setTable(string table)
219 	{
220 		// void gda_field_attributes_set_table (GdaFieldAttributes *fa,  const gchar *table);
221 		gda_field_attributes_set_table(gdaFieldAttributes, Str.toStringz(table));
222 	}
223 	
224 	/**
225 	 * Returns: fa's caption.
226 	 */
227 	public string getCaption()
228 	{
229 		// const gchar* gda_field_attributes_get_caption (GdaFieldAttributes *fa);
230 		return Str.toString(gda_field_attributes_get_caption(gdaFieldAttributes));
231 	}
232 	
233 	/**
234 	 * Sets fa's caption.
235 	 * Params:
236 	 * caption = caption.
237 	 */
238 	public void setCaption(string caption)
239 	{
240 		// void gda_field_attributes_set_caption (GdaFieldAttributes *fa,  const gchar *caption);
241 		gda_field_attributes_set_caption(gdaFieldAttributes, Str.toStringz(caption));
242 	}
243 	
244 	/**
245 	 * Returns: the number of decimals of fa.
246 	 */
247 	public glong getScale()
248 	{
249 		// glong gda_field_attributes_get_scale (GdaFieldAttributes *fa);
250 		return gda_field_attributes_get_scale(gdaFieldAttributes);
251 	}
252 	
253 	/**
254 	 * Sets the scale of fa to scale.
255 	 * Params:
256 	 * scale = number of decimals.
257 	 */
258 	public void setScale(glong scale)
259 	{
260 		// void gda_field_attributes_set_scale (GdaFieldAttributes *fa,  glong scale);
261 		gda_field_attributes_set_scale(gdaFieldAttributes, scale);
262 	}
263 	
264 	/**
265 	 * Returns: the type of fa.
266 	 */
267 	public GdaValueType getGdatype()
268 	{
269 		// GdaValueType gda_field_attributes_get_gdatype (GdaFieldAttributes *fa);
270 		return gda_field_attributes_get_gdatype(gdaFieldAttributes);
271 	}
272 	
273 	/**
274 	 * Sets the type of fa to type.
275 	 * Params:
276 	 * type = the new type of fa.
277 	 */
278 	public void setGdatype(GdaValueType type)
279 	{
280 		// void gda_field_attributes_set_gdatype (GdaFieldAttributes *fa,  GdaValueType type);
281 		gda_field_attributes_set_gdatype(gdaFieldAttributes, type);
282 	}
283 	
284 	/**
285 	 * Gets the 'allow null' flag of the given field attributes.
286 	 * Returns: whether the given field allows null values or not (TRUE or FALSE).
287 	 */
288 	public int getAllowNull()
289 	{
290 		// gboolean gda_field_attributes_get_allow_null (GdaFieldAttributes *fa);
291 		return gda_field_attributes_get_allow_null(gdaFieldAttributes);
292 	}
293 	
294 	/**
295 	 * Sets the 'allow null' flag of the given field attributes.
296 	 * Params:
297 	 * allow = whether the given field should allows null values or not.
298 	 */
299 	public void setAllowNull(int allow)
300 	{
301 		// void gda_field_attributes_set_allow_null (GdaFieldAttributes *fa,  gboolean allow);
302 		gda_field_attributes_set_allow_null(gdaFieldAttributes, allow);
303 	}
304 	
305 	/**
306 	 * Returns: whether if the given field is a primary key (TRUE or FALSE).
307 	 */
308 	public int getPrimaryKey()
309 	{
310 		// gboolean gda_field_attributes_get_primary_key  (GdaFieldAttributes *fa);
311 		return gda_field_attributes_get_primary_key(gdaFieldAttributes);
312 	}
313 	
314 	/**
315 	 * Sets the 'primary key' flag of the given field attributes.
316 	 * Params:
317 	 * pk = whether if the given field should be a primary key.
318 	 */
319 	public void setPrimaryKey(int pk)
320 	{
321 		// void gda_field_attributes_set_primary_key  (GdaFieldAttributes *fa,  gboolean pk);
322 		gda_field_attributes_set_primary_key(gdaFieldAttributes, pk);
323 	}
324 	
325 	/**
326 	 * Returns: whether if the given field is an unique key (TRUE or FALSE).
327 	 */
328 	public int getUniqueKey()
329 	{
330 		// gboolean gda_field_attributes_get_unique_key (GdaFieldAttributes *fa);
331 		return gda_field_attributes_get_unique_key(gdaFieldAttributes);
332 	}
333 	
334 	/**
335 	 * Sets the 'unique key' flag of the given field attributes.
336 	 * Params:
337 	 * uk = whether if the given field should be an unique key.
338 	 */
339 	public void setUniqueKey(int uk)
340 	{
341 		// void gda_field_attributes_set_unique_key (GdaFieldAttributes *fa,  gboolean uk);
342 		gda_field_attributes_set_unique_key(gdaFieldAttributes, uk);
343 	}
344 	
345 	/**
346 	 * Returns: fa's references.
347 	 */
348 	public string getReferences()
349 	{
350 		// const gchar* gda_field_attributes_get_references (GdaFieldAttributes *fa);
351 		return Str.toString(gda_field_attributes_get_references(gdaFieldAttributes));
352 	}
353 	
354 	/**
355 	 * Sets fa's references.
356 	 * Params:
357 	 * ref = references.
358 	 */
359 	public void setReferences(string doref)
360 	{
361 		// void gda_field_attributes_set_references (GdaFieldAttributes *fa,  const gchar *ref);
362 		gda_field_attributes_set_references(gdaFieldAttributes, Str.toStringz(doref));
363 	}
364 	
365 	/**
366 	 * Returns: whether the given field is an auto incremented one (TRUE or FALSE).
367 	 */
368 	public int getAutoIncrement()
369 	{
370 		// gboolean gda_field_attributes_get_auto_increment  (GdaFieldAttributes *fa);
371 		return gda_field_attributes_get_auto_increment(gdaFieldAttributes);
372 	}
373 	
374 	/**
375 	 * Sets the auto increment flag for the given field.
376 	 * Params:
377 	 * isAuto = auto increment status.
378 	 */
379 	public void setAutoIncrement(int isAuto)
380 	{
381 		// void gda_field_attributes_set_auto_increment  (GdaFieldAttributes *fa,  gboolean is_auto);
382 		gda_field_attributes_set_auto_increment(gdaFieldAttributes, isAuto);
383 	}
384 	
385 	/**
386 	 * Returns: the position of the field the attributes refer to in the containing data model.
387 	 */
388 	public int getPosition()
389 	{
390 		// gint gda_field_attributes_get_position (GdaFieldAttributes *fa);
391 		return gda_field_attributes_get_position(gdaFieldAttributes);
392 	}
393 	
394 	/**
395 	 * Sets the position of the field the attributes refer to in the containing
396 	 * data model.
397 	 * Params:
398 	 * position = the wanted position of the field in the containing data model.
399 	 */
400 	public void setPosition(int position)
401 	{
402 		// void gda_field_attributes_set_position (GdaFieldAttributes *fa,  gint position);
403 		gda_field_attributes_set_position(gdaFieldAttributes, position);
404 	}
405 	
406 	/**
407 	 * Params:
408 	 * fa = a GdaFieldAttributes.
409 	 * Returns: fa's default value, as a GdaValue object.
410 	 */
411 	public Value getDefaultValue()
412 	{
413 		// const GdaValue* gda_field_attributes_get_default_value  (GdaFieldAttributes *fa);
414 		auto p = gda_field_attributes_get_default_value(gdaFieldAttributes);
415 		
416 		if(p is null)
417 		{
418 			return null;
419 		}
420 		
421 		return ObjectG.getDObject!(Value)(cast(GdaValue*) p);
422 	}
423 	
424 	/**
425 	 * Sets fa's default GdaValue.
426 	 * Params:
427 	 * fa = a GdaFieldAttributes.
428 	 * defaultValue = default GdaValue for the field
429 	 */
430 	public void setDefaultValue(Value defaultValue)
431 	{
432 		// void gda_field_attributes_set_default_value  (GdaFieldAttributes *fa,  const GdaValue *default_value);
433 		gda_field_attributes_set_default_value(gdaFieldAttributes, (defaultValue is null) ? null : defaultValue.getValueStruct());
434 	}
435 }